I am using code block below to get LDAP username (I am giving only first line)
using (PrincipalContext context = new PrincipalContext(ContextType.Domain))
{
}
It gives me an error once I publish the asp.net MVC app to server.
ArgumentException: The (&(objectCategory=user)(objectClass=user)(|(userPrincipalName=)(distinguishedName=)(name=))) search filter is invalid.]
Try to pass the domain parameter like this.
using(PrincipalContext pc = new PrincipalContext(ContextType.Domain, domain)) {
// validate the credentials
result = pc.ValidateCredentials(username, password);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.