if (Request.ServerVariables[ " HTTP_VIA " ] != null ) { string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); } else { string user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); } 转载于:https://www.cnblogs.com/lbq1221119/archive/2007/08/17/859503.html