public static String GetIP() { String ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (string.IsNullOrEmpty(ip)) { ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } return ip; }…
Java的api的说法: getHeader public java.lang.String getHeader(java.lang.String name) Return the first value of the specified header, if any; otherwise, return null 返回指定标头的第一个值(如果有的话):否则返回null. Specified by: getHeader in interface javax.servlet.http.HttpSe…