Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 (PrincipalContext pc = new PrincipalContext(ContextType.Domain, domainName)) { isWindowsAutenticated = pc.ValidateCredentials(username, password); }
如果向此代码传递了许多错误的用户密码,然后传入正确的密码,即使密码绝对正确,它仍然返回 false。
任何解决此问题的建议表示赞赏。
username您传入的内容很重要:
username
MSDN没有具体说明,但我的经验表明第一个是唯一正确的,并且比较不区分大小写。