LDAP
C#
2
Posts
2
Posters
0
Views
1
Watching
-
Can somebody point me to LDAP code for authenticating a user through LDAP or active directory. Thanks in Advance. Ramendra Kotharkar Ramendra K
DirectoryEntry entry = new DirectoryEntry("LDAP://testdomain/DC=testdomain", "testdomain/" + textUser.Text, textPassword.Text); Object obj = entry.NativeObject; DirectorySearcher search = new DirectorySearcher(entry); search.Filter = "(SAMAccountName=" + textUser.Text + ")"; search.PropertiesToLoad.Add("cn"); SearchResult result = search.FindOne(); if (null == result) { . . . }
This only works with AD, by the way: if you find that works with LDAP, please let me know