问题
I know to get the distinguish name for Active directory server:
DirectoryEntry nRoot = new DirectoryEntry("LDAP://localhost:389");//this for OpenLDAP
string dnPath = nRoot.Properties["distinguishedName"].Value.ToString();
I am getting an error that 'An invalid dn syntax has been specified'
though if try the same code with AD server IP instead of localhost:389 it runs perfectly.
Any idea?
Thanks!
回答1:
I'm not sure I follow what you mean by the "distinguishedName of an Active Directory server"... What is you're actually trying to accomplish?
Your current code will essentially bind to what's called RootDSE on the local domain controller.
来源:https://stackoverflow.com/questions/11122947/how-to-get-distinguishname-for-openldap-sever