I am trying to authenticate user against LDAP using below code.
using (PrincipalContext context = new PrincipalContext(ContextType.Domain, ldap, "username", "password"))
{
bool success = context.ValidateCredentials(useralias, password);
}
When I use ldap as "LDAP://z.y.org:389/ I receive as error saying "Unable to contact server" at the PrincipalContext initialization.
If I use ldap as "z.y.org:389/" it succeeds that steps and success is "true" if I use right credentials, but I can see two exceptions in "IntelliTrace" saying "The LDAP server is unavailable" when ValidateCredentails is executed. If I supply wrong credentials to this method if get false but still get same exceptions recorded in "IntelliTrace".
Any pointers to resolve the issue or debug on what is going on are highly appreciated.