c# - How to get domain controller IP Address -


How do you use the domain controller IP address program in C # ?

Here's how I will do it.

You will need to use System.Net and System.DirectoryServices.

Directory Entry dirEntry = new DirectoryEntry ("LDAP: // RootDSE"); Find the root of the directory data tree on the directory server; // Get the hostname of your root directory server (I'm assuming what you want) string dnsHostname = dirEntry.Properties ["dnsHostname"]. Value.ToString (); IPAddress [] ipAddresses = Dns.GetHostAddresses (dnsHostname);

Comments