获取客户端的主机名

  System.Net.IPAddress ip = System.Net.IPAddress.Parse(Request.UserHostAddress);
                System.Net.IPHostEntry ihe 
= System.Net.Dns.GetHostEntry(ip);
                Label1.
Text = ihe.HostName;//主机名

 Response.Write(Page.Request.UserHostAddress.ToString());//获取IP
            
//Response.Write(Page.Request.ServerVariables["Server_Name"].ToString());//获取HOST域名
            Response.Write(Page.Request.ServerVariables
["Http_Host"].ToString());//获取HOST域名
posted @ 2007-07-16 18:26  wdx2008  阅读(145)  评论(0编辑  收藏