public string GetIP4Address() { IPHostEntry host; string localIp = "?"; string hostName = Dns.GetHostName(); host = Dns.GetHostEntry(hostName); foreach (IPAddress ip in host.AddressList) { if (ip.AddressFamily.ToString() == "InterNetwork") { localIp = ip.ToString(); } //localIp += " " + ip.AddressFamily.ToString() + " "; } return localIp; }
HttpContext.Current.Request.UserHostAddress
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)