Authenticating Active Directory
Windows Forms
1
Posts
1
Posters
0
Views
1
Watching
-
I have a login form which will connect the Active Directory to check the user; but the output that i get is alway not couldn't connect. When the it debugs in the Searcher.FindOne(); I get this error. Boolean Success = false; DirectoryEntry Entry = new DirectoryEntry("LDAP://" + Domain, UserName, Password); DirectorySearcher Searcher = new DirectorySearcher(Entry); Searcher.SearchRoot = Entry; Searcher.Filter = "(&(objectClass=user)(sAMAccountName=" + UserName + "))"; Searcher.PropertiesToLoad.Add("cn"); Searcher.SearchScope = SearchScope.Subtree; try { SearchResult Results = Searcher.FindOne(); Success = (Results != null); } Help me to solve this issue.
Regards, John.L.Ponratnam