ValidateCredentials只会在C#中始终返回false

时间:2017-06-30 19:04:31

标签: c# windows powershell authentication

我希望能够验证特定用户的凭据是否正确。

    public static void DomainVerification(string username, string password)
    {
        bool valid = false;
        using (PrincipalContext context = new PrincipalContext(ContextType.Domain, "domain.com"))
        {
            valid = context.ValidateCredentials(username, password);
        }
}

我不太确定我做错了什么,如果它是一个无效的域或无效的用户/传递组合..

在powershell中,我正在使用wmic computersystem get domain验证域并运行whomai以获取正确的用户名。

什么可能导致有效永远是假的?

0 个答案:

没有答案