asp.net获取客户真实ip非代理ip:

public string GetUserIP()
   {
       string _userIP;
       if(Request.ServerVariables["HTTP_VIA"] == null)
         {
             userIP= Request.UserHostAddress;
         }
       else
        {
           userIP= Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
        }
       return userIP;
    }

原文地址:https://www.cnblogs.com/rengke2002/p/6796352.html