private bool AuthenticateAD(string username, string password)
{
try
{
using (PrincipalContext context = new PrincipalContext(ContextType.Domain, LDAP_DOMAIN))
{
return context.ValidateCredentials(username, password);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace.ToString());
return false;
}
}
The problem is that no matter what values I am passing to the method, it is always returning true No exception is being thrown. I have tried with real usernames and passwords as well as fake accounts.
I confirmed the account doesn't exist in AD.
Not sure what else I can do.