//获取客户端IP地址
public string getIP()
{
string result = String.Empty;
result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (null == result || result == String.Empty)
{
result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
}
if (null == result || result == String.Empty)
{
result = HttpContext.Current.Request.UserHostAddress;
}
if (null == result || result == String.Empty )
{
return "0.0.0.0";
}
return result;
}
阅读(2008) | 评论(0) | 转发(0) |