I'm using System.DirectoryServices
to query active directory to authenticate/fetch users' info in a winforms appliation. Something like below:
var path = "LDAP://" + domain;
var entry = new DirectoryEntry(path);
DirectorySearcher myDirectorySearcher = new DirectorySearcher(entry);
var filter = string.Format("(&(ObjectClass={0})(sAMAccountName={1}))", "person", username);
myDirectorySearcher.Filter = filter;
I can only test this code on company's Active Directory. Is this going to work on any technology that supports LDAP
?