see http://www.aspfaq.com/show.asp?id=2044"..... IIS does not automatically do reverse DNS lookups - by default, Request.ServerVariables("REMOTE_HOST") is populated with the same value as Request.ServerVariables("REMOTE_ADDR") - which is simply an IP address
http://www.aspfaq.com/show.asp?id=2044".....
IIS does not automatically do reverse DNS lookups - by default, Request.ServerVariables("REMOTE_HOST") is populated with the same value as Request.ServerVariables("REMOTE_ADDR") - which is simply an IP address
string hostIp = Request.ServerVariables["REMOTE_ADDR"];
//得到主机名hostName
System.Net.IPAddress address = System.Net.IPAddress.Parse(hostIp);
System.Net.IPHostEntry ipInfor = System.Net.Dns.GetHostByAddress(address);
string hostName = ipInfor.HostName;记得给分哦。