I am doing password verification against Active Directory using the following code. The query takes 4 seconds.
Why is it so slow?
DirectoryEntry searchRoot = new DirectoryEntry(
"LDAP://ldap.subdomain.com:636/cn=serviceaccount,OU=serviceaccounts,DC=domain,DC=internal",
username,
password,
AuthenticationTypes.Secure);
try
{
DirectorySearcher ds = new DirectorySearcher(searchRoot);
ds.FindOne();
// Success!
}
catch (Exception ex)
{
Response.Write(ex.Message);
// Failure
}