Ex : I want something like abc.hyd.mycompany.com. My requirement is to parse this name and initialize appropriate service.
use System.net;
Dns.GetHostName() doesn't return fully qualified name it just gives "abc"
Ex : I want something like abc.hyd.mycompany.com. My requirement is to parse this name and initialize appropriate service.
use System.net;
Dns.GetHostName() doesn't return fully qualified name it just gives "abc"
You may be able to get the whole DNS string like this:
System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).HostName
We don't have full fledged DNS names where I work, but it does give me a three level faux domain name instead of just the hostname.
If the above doesn't work, you can also try retrieving it from the environment:
var dnsName = new StringBuilder();
dnsName.Append(Environment.GetEnvironmentVariable("COMPUTERNAME")).Append(".");
dnsName.Append(Environment.GetEnvironmentVariable("USERDNSDOMAIN"));