string result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (null == result || result == String.Empty) { result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } if (null == result || result == String.Empty) { result = HttpContext.Current.Request.UserHostAddress; } return result; }
------解决方案-------------------- 不知道那个免费的IP服务是不是满足你的要求,就是网上人家提供的webservice接口。
------解决方案--------------------