日期:2014-05-17 浏览次数:20386 次
public static string GetIP() { string user_IP; if (HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null) { user_IP = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); } else { user_IP = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString(); } return user_IP; }