public static string GetIP()
{
string str = "";
//穿过代理服务器取远程用户真实IP地址:
if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
{
str = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
str = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
}
return str;
}
穿过代理服务器取远程用户真实IP地址
最新推荐文章于 2020-12-31 09:06:31 发布