I have used below code to authenticate user with Active Directory.
- using (PrincipalContext principalContext1 = new PrincipalContext(ContextType.Domain, domainName))
- {
- if (principalContext1.ValidateCredentials(userName, password))
- {
-
- }
- }
Getting error "The server cannot handle directory requests." in ValidateCredentials method.
I have tried passing contextOptions as third parameter "ContextOptions.Negotiate | ContextOptions.Signing | ContextOptions.Sealing" in ValidateCredentials method.
It resolved my error, but I came to know from msdn that it is default parameter.
Why should I need to pass this? Any alternative solutions? Thanks in advance.