Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

ldap check user exists

public bool UserExists(string username)
{
   // create your domain context
   using (PrincipalContext domain = new PrincipalContext(ContextType.Domain))
   {
       // find the user
       UserPrincipal foundUser = UserPrincipal.FindByIdentity(domain, IdentityType.Name, username);

       return foundUser != null;
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ldap #check #user #exists
ADD COMMENT
Topic
Name
1+6 =