主机时如何获取客户端系统的IP地址 [英] How to get the IP address of the client system when it is host
本文介绍了主机时如何获取客户端系统的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string strHostName = System.Net.Dns.GetHostName();
objUsers.ClientIP = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
我正在使用上面的代码来获取主机的客户端IP地址.当我在本地系统中测试时,它可以正常工作,我的IP地址为:198.168.1.143.当它是主机时,会出现问题,我的IP地址为: fe80 :: ed72:d42c:27a3:e8df%10
如何以正确的方式获取客户端IP可以有人帮助我吗....
i am using above code to get the client IP address of the when it is host. when i am testing in local system it working fine i am getting IP:198.168.1.143. The problem arise when it is host I am getting IP address as: fe80::ed72:d42c:27a3:e8df%10
How to get the client IP in proper manner Can any one help me.....
推荐答案
使用 ^ ]
请参阅以下内容:
如何获取IP地址 [ http://bytes.com/topic/asp- classic/answers/439176-how-get-clients-ip-address-asp-net [ http://www.dotnetperls.com/ip [
Refer these:
How to get IP address[^]
http://bytes.com/topic/asp-classic/answers/439176-how-get-clients-ip-address-asp-net[^]
http://www.dotnetperls.com/ip[^]
使用
服务器变量
这篇关于主机时如何获取客户端系统的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文