返回首页

HI
的 。
我赛伦德拉・辛格,任何人帮助的一些疑难问题想获得客户端的IP地址与ASP.NET(C#中)的帮助下,我怎样才能得到客户机的IP在asp.net(C#中)
NBSP

NBSP
NBSP提前感谢。

回答

评论会员:OriginalGriff 时间:2012/02/06
尝试:
Request.ServerVariables("REMOTE_ADDR")
Request.UserHostAddress
评论会员:devildx2050 时间:2012/02/06
Get users IP address

 

Oct 30, 2006 07:41 AM | LINK

 

HttpContext.Current.Request.UserHostAddress;

or

HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

 

To get the IP address of the machine and not the proxy use the following code

 

HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
的| devildx2050
评论会员:{体C3} 时间:2012/02/06