You can use the following code snippet in your masterpage (replace Console.WriteLine
with assigning text to your control):
String strHostName = string.Empty;
strHostName = Dns.GetHostName();
IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);
IPAddress[] addr = ipEntry.AddressList;
for (int i = 0; i < addr.Length; i++)
{
if (!addr[i].IsIPv6LinkLocal)
{
Console.WriteLine("IP Address: {0} ", addr[i].ToString());
}
}
Also, I suggest you make the foreground color equal to background color. That way no one will see it and you'll be able to select it with mouse.
Source: https://stackoverflow.com/questions/6803073/get-local-ip-address