我使用下面的代码来获取客户端计算机名称,但是它适用于某些客户端,而某些客户端会出现错误
string IPAdd = Request.UserHostName;
IPHostEntry hostEntry = Dns.GetHostEntry(IPAdd);
string compName = hostEntry.HostName;
Below picture is the error:
没有这样的主机是已知的。
第33行: string IPAdd = Request.UserHostName;
第 34 行:IPHostEntry hostEntry = Dns.GetHostEntry(IPAdd);
请帮忙,谢谢。
使用此代码
字符串 compName = Environment.MachineName.ToString();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)