我有以下代码来验证 Active Directory 用户(Win7 上的 VS2008)。
try
{
PrincipalContext pc = new PrincipalContext(ContextType.Domain, strDomainName))
isPass = pc.ValidateCredentials(strDomainUserName, strDomainUserPass);
}
catch (Exception ex)
{
Logger.Log("authentiate domain user fail: {0},{1}", ex.ToString(), strDomainUserLoginName);
}
对于某些 AD 用户,可以,但对于 AD 用户,我会得到以下异常:
System.DirectoryServices.Protocols.DirectoryOperationException:
The server cannot handle directory requests.
System.DirectoryServices.Protocols.ErrorChecking.CheckAndSetLdapError(Int32 error)
System.DirectoryServices.Protocols.LdapSessionOptions.FastConcurrentBind()
System.DirectoryServices.AccountManagement.CredentialValidator.BindLdap(NetworkCredential creds, ContextOptions contextOptions)
System.DirectoryServices.AccountManagement.CredentialValidator.Validate(String userName, String password)
System.DirectoryServices.AccountManagement.PrincipalContext.ValidateCredentials(String userName, String password)
那么 Active Directory 域用户设置会导致这样的异常吗?