I understand that System.DirectoryServices is a "layer above" System.DirectoryServices.Protocols and abstracts some of the complexity.
Are there any other advantages, performance or otherwise, to using System.DirectoryServices.DirectorySearcher vs. System.DirectoryServices.Protocols.SearchRequest for LDAP queries from .NET.
What criteria would cause you to use one approach over the other?
Having dealt with both libraries a lot over the last few months, I can tell you there are some big differences, especially if you're dealing with large datasets. This blog post outlines just a few of the problems, and having dealt with LDAP instances containing over 500,000 entries, I can vouch for its accuracy.
The System.DirectoryServices
namespace uses a lot of ADSI and COM under the surface which can add a lot of overhead, particularly with disposing objects. The System.DirectoryServices.Protocols
interacts directly with the low level LDAP APIs, giving you much more control and much better interoperability with non-Microsoft directories.
If all you're trying to achieve is some quick and easy connectivity to an AD/ADAM/ADLDS instance for relatively simple operations, it might be worth sticking with that namespace - otherwise, I would strongly recommend you invest the time to learn the Protocols namespace. I found this MSDN article to be a huge help when I was learning originally - it covers pretty much everything you'll need to know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With