... using System.DirectoryServices; ... public bool IsValidLDAPUser(string userName, string password, string ldapPath) { DirectoryEntry entry = new DirectoryEntry(ldapPath, userName, password); DirectorySearcher searcher = new DirectorySearcher(entry); searcher.SearchScope = SearchScope.OneLevel; try { SearchResult result = searcher.FindOne(); return result != null ? true : false; } catch { return false; } finally { if (searcher != null) searcher.Dispose(); if (entry != null) entry.Dispose(); } } ...
A blog by an ordinary Linux user who uses Windows in his day job.
Tuesday, May 10, 2011
Validate user against LDAP...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment