PrincipalContext.ValidateCredentials gibt immer FALSE zurück

Ich habe eine MVC-Anwendung, die sich anmelden und einen Benutzer gegen Active Directory verifizieren muss. Ich benutze diePrincipalContext.ValidateCredentials Methode aber immer eine Authentifizierung vonfalse.

Die Verbindung zum Server ist in Ordnung. Das Problem scheint in der aufzutretenValidateCredentials.

Hier ist mein Code:

public static bool IsAuthenticated(string domain, string username, string pwd) {
    bool IsAuthenticated = false;

    try {
        PrincipalContext insPrincipalContext = 
            new PrincipalContext(ContextType.Domain, domain, "DC=c1w,DC=com");

        username = "c1w\\" + username;

        IsAuthenticated = insPrincipalContext.ValidateCredentials(username, pwd);
    }
    catch (Exception ex)
    {
        // Rethrow this exception
        ExceptionPolicy.HandleException(ex, "Exception Policy");
    }

    return IsAuthenticated;
}

Weiß jemand, warum das passieren würde?

Antworten auf die Frage(3)

Ihre Antwort auf die Frage