You can use Dns.GetHostEntry using your client IP to get the hostname from the DNS server.
http://msdn.microsoft.com/en-us/library/ms143997(v=vs.110).aspx
Pregunta
My website is in an intranet network
. I get client Ip Address using following code:
string result= HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]
Now I want to retrieve client computer name
with Ip Address. I can get Client Computer name
with nslookup IpAddress
in command prompt. I want to implement nslookup
in my asp.net website.
How can I do it?
No hay solución correcta
Otros consejos
You can use Dns.GetHostEntry using your client IP to get the hostname from the DNS server.
http://msdn.microsoft.com/en-us/library/ms143997(v=vs.110).aspx
This link contains your answer: System.Net.Dns.GetHostName()
More info about this link:
Using the following code you can get the hostname of the clients machine:
string myHostName = System.Net.Dns.GetHostName();