views:

21

answers:

0

Why does the following code lock the account out after one unsuccessful attempt when the policy in AD is set to three attempts? Is there a better way of checking credentials programmatically against AD.

private bool Authenticate(string userName,
    string password, string domain)
{
    bool authentic = false;
    try
    {
        DirectoryEntry entry = new DirectoryEntry("LDAP://" + domain,
            userName, password);
        object nativeObject = entry.NativeObject;
        authentic = true;
    }
    catch (DirectoryServicesCOMException) { }
    return authentic;
}

Working fine when the correct credentials are entered...

Thanks,