private string GetUserIP()
{
string ipList = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (!string.IsNullOrEmpty(ipList))
{
return ipList.Split(',')[0];
}
return Request.ServerVariables["REMOTE_ADDR"];
}
我总是收到null
上述功能的回报。我期待价值,即192.168.1.100
我将上面的内部代码替换为return Request.UserHostAddress;
并收到::1