asp.net中获取客户端IP
2011-09-07 20:49
337 查看
private string GetClientIP()
{
string result = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; //http_forwarded_for
if (null == result || result == String.Empty)
{
result = Request.ServerVariables["REMOTE_ADDR"];//remote_addr
}
if (null == result || result == String.Empty)
{
result = Request.UserHostAddress;
}
return result;
}
{
string result = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; //http_forwarded_for
if (null == result || result == String.Empty)
{
result = Request.ServerVariables["REMOTE_ADDR"];//remote_addr
}
if (null == result || result == String.Empty)
{
result = Request.UserHostAddress;
}
return result;
}
相关文章推荐
- asp.net获取客户端IP,Mac
- ASP.NET获取客户端IP/用户名等信息
- asp.net 获取客户端真实Ip
- ASP.NET获取客户端IP及MAC地址
- ASP.NET获取客户端IP及MAC地址
- Asp.net获取客户端IP常见代码存在的伪造IP问题探讨
- ASP.NET获取客户端IP/用户名等信息
- ASP.NET获取客户端IP/用户名等信息
- ASP.NET获取客户端IP及MAC地址
- ASP.NET获取客户端IP/用户名等信息
- asp.net各种获取客户端ip方法
- asp.net获取客户端IP方法(转载)
- ASP.NET获取客户端IP及MAC地址
- ASP.NET获取客户端IP/用户名等信息
- ASP.NET获取客户端IP/用户名等信息
- asp.net 获取客户端ip
- ASP.NET获取客户端IP及MAC地址
- asp.net 获取获取客户端IP,名称等地址
- ASP.NET获取客户端IP及MAC地址
- ASP.NET,C#获取客户端IP