Created
June 3, 2015 15:05
-
-
Save robertmuehsig/8e608945dd4654b8b641 to your computer and use it in GitHub Desktop.
LDAPS Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inputs: ldapConnection like ldap.foobar.local:636 | |
// authType like Basic? | |
var entry = new DirectoryEntry(ldapConnection, username, password); | |
entry.AuthenticationType = authType; | |
var searcher = new DirectorySearcher(entry); | |
searcher.PageSize = 1000; | |
searcher.Filter = Config.Instance.LdapFilter; | |
searcher.SearchScope = SearchScope.Subtree; | |
searcher.PropertiesToLoad.AddRange(...); | |
SearchResultCollection result = null; | |
try | |
{ | |
result = searcher.FindAll(); | |
} | |
catch(Exception exc) | |
{ | |
// :( | |
throw; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment