I’ve got an asp application running but i want to search the Active Directory.
i am using vb (visual web developer 2008)
how do i search the active directory for a given user?
ie: user enters login name in text box, clicks submit. active directory is searched on-click for this user. when found user information is displayed .
Thanks
What version of the .NET framework can you use? Searching and looking up stuff in AD has become extremely easy in .NET 3.5 – see this great MSDN article by Ethan Wilanski and Joe Kaplan on using the security principals API for that.
If you’re not on .NET 3.5 yet, you’ll have to use the
DirectorySearcherclass and set up the search filters as you need. Getting the LDAP filter right is probably the biggest obstacle.Robbie Allen also has two great intro article on System.DirectoryServices programming:
– Part 1
– Part 2
There are some really good resources at http://www.directoryprogramming.net (Joe Kaplan’s site – he’s a Microsoft Active Directory MVP), and Richard Mueller has some great reference excel sheets on what properties are available for each of the ADSI providers, and what they mean, and how their LDAP name is – see http://www.rlmueller.net.
Marc
EDIT: Ok- here’s the .NET 2.0 / 3.0 approach:
Hope this helps!
Marc