如何获取正在使用我的域URL的客户端本地IP地址?

时间:2018-09-03 05:11:44

标签: c# asp.net

我尝试通过以下代码获取客户端系统的本地ip,但是如果客户端本地ip,此代码仅返回服务器ip和以太网ip?你能帮我如何客户端本地IP吗?

DateTime today = System.DateTime.Now;
string userid = HttpContext.Current.Session["UserId"].ToString();
string hostName = System.Net.Dns.GetHostName();
IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(GetCompCode());
IPAddress[] addr = ipEntry.AddressList;
string ipaddress = addr[addr.Length - 1].ToString();
string SystemName = System.Environment.MachineName;

0 个答案:

没有答案