0

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?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Raymond Morphy
  • 2,464
  • 9
  • 51
  • 93

2 Answers2

0

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

Akeel
  • 121
  • 4
0

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();
Mivaweb
  • 5,580
  • 3
  • 27
  • 53