문제

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

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();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top