以下是asp.net获得客户端ip地址的方法!

1. HttpContext.Current.Request.UserHostAddress;

使用方法:string strip=HttpContext.Current.Request.UserHostAddress;

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

使用方法:同上

3.string?strHostName?=?System.Net.Dns.GetHostName();
asp.net 获取客户端ip地址-魏星博客string?clientIPAddress?=?System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();

4.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

5.function?GetLocalIPAddress()
{
var obj = null;
var rslt = "";
try
{
obj = new ActiveXObject("rcbdyctl.Setting");
rslt = obj.GetIPAddress;
obj = null;
}
catch(e)
{
//
}

return rslt;
}

6.