DynDeveloper.com

DynDeveloper.com

Sign Up Now! Log In
sgray128 6/14/2012 6:44:51 PM

LDAP - How to validate a user

* This article, and all our great .NET Development documentation, Is available on the .NET Development menu

In a recent project I had to validate that a user was valid against Active Directory. I'm not that good at LDAP queries so I thought I'd document this code in case it came up again.

The code shows a successful and failed lookup against a domain. Note that there is no password, we're only validating that the user exists.

I'm showing two different approacher, one uses the DirectoryServices namespace and the other uses DirectoryServices.AccountManagement. I'm not expert enough to know which is better... I just need the end result.

 

 

Version: Unknown or N/A
Section: .NET Development