Our transition to the System.DirectoryServices.Protocols has in the whole gone very smooth, but there have been some issues with one environment that contains subdomains. Most things are working fine, but writing to a subdomain does not work in the same way as it did before.
What is generally bad with the System.DirectoryServices.Protocols is the documentation, which is practically non-existent. But most things can be figured out anyway since most classes just are wrappers for the wldap32.dll, which in turn is way better documented.
I would like to have as little bindings to a specific server as possible but still be able to access the domain. In the LdapConnection it is possible to set the identifier to null and use the executing computer as a starting point to find a domain controller. But sometimes I must know that I am using a Global Catalog, and with more and more RODC in the environment I sometimes must know that I am working against a writeable domain controller.
With the property SessionOptions.LocatorFlag I am able to set which type of domain controller that is selected when the connection is created. This beaviour is not very well documented in System.DirectoryServices.Protocols, but it builds on DsGetDcName which has a lot of documentation available.
What is generally bad with the System.DirectoryServices.Protocols is the documentation, which is practically non-existent. But most things can be figured out anyway since most classes just are wrappers for the wldap32.dll, which in turn is way better documented.
I would like to have as little bindings to a specific server as possible but still be able to access the domain. In the LdapConnection it is possible to set the identifier to null and use the executing computer as a starting point to find a domain controller. But sometimes I must know that I am using a Global Catalog, and with more and more RODC in the environment I sometimes must know that I am working against a writeable domain controller.
With the property SessionOptions.LocatorFlag I am able to set which type of domain controller that is selected when the connection is created. This beaviour is not very well documented in System.DirectoryServices.Protocols, but it builds on DsGetDcName which has a lot of documentation available.
NetworkCredential credential = new NetworkCredential("user@domain.local", "password"); using(LdapConnection connection = new LdapConnection(null, credential)) { connection.SessionOptions.LocatorFlag = LocatorFlags.GCRequired | LocatorFlags.WritableRequired; // Search request... }
Comments
Post a Comment