获取客户端、服务器、本地IP地址

//获取客户端、服务器、本地IP地址
        public static string getIPAddress()
        {
            ////本地IP
            //string address = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName()).GetValue(2).ToString();//IP4 地址
            ////本地电脑名称
            //string addname = System.Net.Dns.GetHostName().ToString(); 

            //客户端IP
            HttpRequest Request = HttpContext.Current.Request;
            string clientIP = Request.UserHostAddress;

            return clientIP;
        }

  

posted @ 2014-06-25 11:42  lengv10  阅读(1269)  评论(0编辑  收藏  举报