I am trying to get the computer name for the current user. I am able to get the IP address using System.Net.Dns.GetHostEntry("ComputerName").Address.ToString()
but when I replace the *ComputerName*with the IPAddress I receive the following error.
No such host is known
I enabled reverse DNS in IIS7 by running command: Cscript.exe adsutil.vbs set w3svc/EnableReverseDNS TRUE in the C:\inetpub\AdminScripts directory on my server.
Any ideas on what I'm doing wrong?
The overall purpose is that this will be a help desk application and it will be useful for a user to be able to easily provide their computer name for assistance.
Locally everything works but it does not work once published to the server.
Here is how to obtain it on a different machine. This will also give you the IPv4 version.
class getIP
{
public getIP()
{
IPAddress ip = Dns.GetHostEntry("whybla01").AddressList.Where(o => o.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).First();
Console.WriteLine(ip);
string name = Dns.GetHostEntry(ip).HostName.ToString();
Console.WriteLine(name);
}
}