------解决方案-------------------- string ip = Request.ServerVariables["Remote_Addr"]; string ip = Request.UserHostAddress;
------解决方案--------------------
------解决方案-------------------- 知道的也就lz这样的了 public static string GetIP() { string result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; if (string.IsNullOrEmpty(result)) result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (string.IsNullOrEmpty(result)) result = HttpContext.Current.Request.UserHostAddress;
if (string.IsNullOrEmpty(result) || !Utils.IsIP(result)) return "127.0.0.1";
return result; }
------解决方案--------------------
------解决方案-------------------- Request.UserHostAddress.ToString() 就可以获得登录客户的IP地址的
------解决方案-------------------- http://topic.csdn.net/u/20090617/11/8f0432b6-84ee-49da-a55f-86b3d343ab8b.html
------解决方案-------------------- string ip = Request.ServerVariables["Remote_Addr"]; string ip = Request.UserHostAddress