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.