如何獲取登錄用戶的IP地址?
public static string GetIP() { string ip; if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null) { ip = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); } else { ip = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString(); } return ip; }