ValidateCredentials returns true for unknown user?

后端 未结 3 1586
别那么骄傲
别那么骄傲 2020-12-06 02:26

I\'m seeing some odd behaviour here using PrincipalContext.ValidateCredentials. The set-up is two Active Directory domains in parent/child setup (so we have pri

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-06 02:58

    I have used ContextOptions.SimpleBind flag with ValidateCredentials it solved my problem..

    Sample code:

        using (var context = new PrincipalContext(ContextType.Domain, "DOMAIN", null))
        {
            bool loginResult = context.ValidateCredentials(username, password, ContextOptions.SimpleBind); // returns false for unknown user
        }
    

提交回复
热议问题