C# | Get My REAL External Public IP Address (not 127 or 192 stuff)
Yes, there is a way. No 127.0.0.1 or 192.168.0.1 stuff. Contact whatsmyip.com and they'll tell you! public static IPAddress GetExternalIp() { string whatIsMyIp = "http://automation.whatismyip.com/n09230945.asp"; WebClient wc = new WebClient(); UTF8Encoding utf8 = new UTF8Encoding(); string requestHtml = ""; try { requestHtml = utf8.GetString(wc.DownloadData(whatIsMyIp)); } catch (WebException we) { // do something with exception Console.Write(we.ToString()); } IPAddress externalIp = IPAddress.Parse(requestHtml); return externalIp; } Thanks to this guys at dreamincode.net http://www.dreamincode.net/forums/topic/24692-showing-the-external-ip-address-in-c%23/ Update: The function appears to return the server IP address. How to get both CLIENT and SERVER public IP Addresses? string serverIP = GetExternalIp().ToStr...