i am trying to validate the credentials of a user against a active directory with a principalcontext but always get an error. I try to connect via ssl, because it is sensitive data, but it always give me the error in the headline.
try
{
PrincipalContext pc = new PrincipalContext(ContextType.Domain, "myAwesomeDomain.com", null, ContextOptions.SecureSocketLayer, adUser, adPassword);
using (pc)
{
retVal = pc.ValidateCredentials(userID, password, ContextOptions.SecureSocketLayer);
}
}
I also tried to set DC="myAwesomeDomain,DC=COM" for the container instead of null. The Credentials to log into the AD are correct, they are working fine with DirectoryEntry. I have no clue how to go on.
Any idea?
Mh, it is some time since now, i found a solution back then:
try
{
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "myAwesomeDomain.com", null, ContextOptions.SecureSocketLayer, adUser, adPassword);
{
retVal = pc.ValidateCredentials(userID, password, ContextOptions.SecureSocketLayer);
}
}
it really worked this way, i can not explain why