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?
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