Last post Oct 03, 2014 04:52 AM by bora long
Sep 30, 2014 09:06 PM|bora long|LINK
I have code:
Dim host1 As System.Net.IPHostEntry
Dim sClientName As String
host1 = System.Net.Dns.GetHostEntry(HttpContext.Current.Request.ServerVariables.Item("REMOTE_HOST"))
sClientName = host1.HostName.ToString
For get the host name ,but sometime i cannot get it from some computer's name. How can i do it?
Sep 30, 2014 09:46 PM|markfitzme|LINK
You can't. Not all IP addresses will resolve to a distinct host name. Keep in mind, this is a host name assigned by an ISP and not the actual computer name and it will change whenever their DHCP renew hits. Also keep in mind this can be a slow operation
as the DNS server may not be the fastest to respond so you will want to use this sparingly.
Oct 01, 2014 11:40 PM|bora long|LINK
If like this , how can i do ?
Can you help me?
Oct 02, 2014 03:20 AM|smirnov|LINK
If you want to find the reason of the problem
1) check what returned in HttpContext.Current.Request.ServerVariables.Item("REMOTE_HOST")
2) if ip from #1 is correct, try to resolve it from the web server (from command prompt)
ping -a <xxx>
do you get the computer name?
3) compare your result with what is described in MSDN: http://msdn.microsoft.com/en-us/library/ms143998(v=vs.100).aspx
Oct 03, 2014 04:52 AM|bora long|LINK
Ok, Thanks you for your advice me.