A random spillage of programming (and other) thoughts

Authenticating users against Active Directory

Posted by Michael Bray on December 13, 2007

string userName = loginName + "@ctiusa.com"; 
DirectoryEntry de = new DirectoryEntry("LDAP://ldapRootPath", userName, password); 
de.AuthenticationType = AuthenticationTypes.Secure; 
System.DirectoryServices.PropertyCollection props = de.Properties; 
    int n = props.Count; 
    return StandardServiceResponse.SuccessResponse;   // Success 
catch (Exception ex) 
    return StandardServiceResponse.InvalidCredentials;   // Error 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: