Connecting to LDAP from C# using DirectoryServices

Well, I think your connection string is missing a bit – specifying just the server name isn’t good enough – you also need to specify a “starting point” for your search.

In AD, this would typically be something like the “Users” container in your domain, which you’d specify like this in LDAP parlance:

LDAP://novellBox.sample.com/cn=Users,dc=YourCompany,dc=com

Not sure how LDAP compliant the newer versions of eDirectory are – but that should work since in theory, it’s standard LDAP regardless of the implementation 🙂

But then again: only in theory, there’s no difference between theory and practice…..

There’s also a System.DirectoryServices.Protocols namespace which offers low-level LDAP calls directly – and that’s definitely not tied to AD at all, but it’s really quite low-level…..

There’s also a Novell C# LDAP library but I’ve never tried it and can’t say how complete or capable it is. It might give you some clues, though!

Also see this other Stackoverflow question about Novell, LDAP and C# – it might give you additional info.

Leave a Comment