Skip to content

Instantly share code, notes, and snippets.

@robertmuehsig
Created June 3, 2015 15:05
Show Gist options
  • Save robertmuehsig/8e608945dd4654b8b641 to your computer and use it in GitHub Desktop.
Save robertmuehsig/8e608945dd4654b8b641 to your computer and use it in GitHub Desktop.
LDAPS Problem
// 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