日期:2014-05-16 浏览次数:20531 次
private string GetClientIP()
{
string 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;
}
return result;
}