I have used below code to authenticate user with Active Directory.
- using (PrincipalContext principalContext1 = new PrincipalContext(ContextType.Domain, domainName))
- {
- if (principalContext1.ValidateCredentials(userName, password))
- {
- //code to successful login
- }
- }
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.

Rajneesh ChaubeyRank #1,073 · 1.8K reputationPosted Feb 19, 2018, 5:50 AM EST
savan savani8 reputationPosted Feb 19, 2018, 9:49 PM EST