Accessing the DNS suffix?

  • Thread starter Thread starter Ted Graham
  • Start date Start date
T

Ted Graham

Anyone know how to get the full network name for the current machine?
If my machine is tedsmachine and is in yahoo's domain, I want to get
tedsmachine.yahoo.com

System.Security.Principal.WindowsIdentity.GetCurrent().Name gets the
machineName\WindowsUser. E.g., tedsmachine\tedg

Dns.GetHostName() gets just the machine. E.g., tedsmachine

Dns also offers Resolve(), but that gets me an IP address.

Running ipconfig I can see the DNS Suffix, but I don't know how to
access it.

I'm using C#, but I'll take sample code in any language. Thanks!
 
Hi Ted,

Try this way:
Dns.GetHostByName(Dns.GetHostName()).HostName

Does it work for you?

Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top