Click here to Skip to main content
13,354,132 members (56,391 online)
Click here to Skip to main content
Add your own
alternative version


78 bookmarked
Posted 10 Feb 2002

Using Active Directory In ASP.NET - Enumerate Active Directory Users

, 10 Feb 2002
Rate this:
Please Sign up or sign in to vote.
An article on using DirectoryServices namespace to enumerate Active Directory Users
<!-- Download Links --> <!-- Article image -->

Sample Image - ADSI2.gif

<!-- Add the rest of your HTML here -->

This article is second in the series demonstrating the use of Active Directory in ASP.Net. The first article Using Active Directory In ASP.Net - Dump Schema Informations demonstrated how to get the schema information. In this article we will use the basics discussed earlier to enumerate the Active Direftory users.

This article demonstrates the use of following namespaces and classes.

  • System.DirectoryServices
  • System.DirectoryServices.DirectoryEntry
  • System.DirectoryServices.DirectorySearcher
  • System.DirectoryServices.SearchResultCollection
  • System.DirectoryServices.SearchResult
  • System.DirectoryServices.ResultPropertyCollection
  • System.DirectoryServices.PropertyValueCollection

The basics steps to implement the enumeration of Active Directory Users remain the same as discussed in the first article, Using Active Directory In ASP.NET - Dump Schema Information. The only difference is the query that is used to search for the Users.

We have added a new method, GetUsersList in ADSIUtil class. This method sets the appropriate search criteria filter to look for all the Active Directory Users. To get the list of Users, the filter is set to look for User object class.

SearchResultCollection results;
DirectorySearcher srch = new DirectorySearcher(m_obDirEntry);
srch.Filter = "(objectClass=User)";
results = srch.FindAll();

Platforms Tested

We have tested the included project on following platforms

  • Windows 2000 Adv. Server
  • Windows .NET Enterprise Server (Beta 3)

Contact Us

For any comments or suggestions, feel free to contact us at or visit us Softomatix


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
United States United States
To learn more about us, Please visit us at

You may also be interested in...

Comments and Discussions

GeneralNot very helpful Pin
knuteski12-Nov-07 10:31
memberknuteski12-Nov-07 10:31 
GeneralRuntime error Pin
New_Beau13-Oct-07 13:23
memberNew_Beau13-Oct-07 13:23 
GeneralRe: Runtime error Pin
tom57200730-Jun-11 1:12
membertom57200730-Jun-11 1:12 
GeneralComputer information Pin
marker274-Mar-06 5:04
membermarker274-Mar-06 5:04 
Hi this is slightly off topic. But is there any who knows how to get the age or date of when the computer was joined on the AD/Domain?

Questionhow to get my pc info Pin
Jwalant Natvarlal Soneji21-Dec-05 20:50
memberJwalant Natvarlal Soneji21-Dec-05 20:50 
AnswerRe: how to get my pc info Pin
SuNNySiDeDowN10-Apr-07 13:23
memberSuNNySiDeDowN10-Apr-07 13:23 
GeneralRe: how to get my pc info Pin
Jwalant Natvarlal Soneji11-Apr-07 17:28
memberJwalant Natvarlal Soneji11-Apr-07 17:28 
Generalrecorrer result Pin
elPooldotNET25-May-05 5:11
memberelPooldotNET25-May-05 5:11 
GeneralSystem show error message Pin
pengyou4-Apr-04 4:46
memberpengyou4-Apr-04 4:46 
General** The server is not operational Pin
x0n1-Apr-03 3:44
memberx0n1-Apr-03 3:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180111.1 | Last Updated 11 Feb 2002
Article Copyright 2002 by Softomatix
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid