//方法一 HttpContext.Current.Request.UserHostAddress;

//方法二 HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

//方法三 string strHostName = System.Net.Dns.GetHostName(); string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();

//方法四(无视代理) HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

 posted on 2012-10-26 10:26  aweifly  阅读(117)  评论(0编辑  收藏  举报