Click here to Skip to main content
Licence 
First Posted 10 Feb 2002
Views 196,618
Downloads 2,898
Bookmarked 77 times

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

By Softomatix | 10 Feb 2002
An article on using DirectoryServices namespace to enumerate Active Directory Users
8 votes, 47.1%
1
1 vote, 5.9%
2
2 votes, 11.8%
3
2 votes, 11.8%
4
4 votes, 23.5%
5
2.52/5 - 18 votes
μ 2.55, σa 3.03 [?]

Sample Image - ADSI2.gif

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 softomatix@pardesiservices.com or visit us Softomatix

License

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

Softomatix

Web Developer

United States United States

Member
To learn more about us, Please visit us at http://www.netomatix.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralNot very helpful Pinmemberknuteski10:31 12 Nov '07  
GeneralRuntime error PinmemberNew_Beau13:23 13 Oct '07  
GeneralRe: Runtime error Pinmembertom5720071:12 30 Jun '11  
GeneralComputer information Pinmembermarker275:04 4 Mar '06  
Questionhow to get my pc info PinmemberJwalant Natvarlal Soneji20:50 21 Dec '05  
AnswerRe: how to get my pc info PinmemberSuNNySiDeDowN13:23 10 Apr '07  
GeneralRe: how to get my pc info PinmemberJwalant Natvarlal Soneji17:28 11 Apr '07  
Generalrecorrer result PinmemberelPooldotNET5:11 25 May '05  
GeneralSystem show error message Pinmemberpengyou4:46 4 Apr '04  
General** The server is not operational Pinmemberx0n3:44 1 Apr '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.5.120209.1 | Last Updated 11 Feb 2002
Article Copyright 2002 by Softomatix
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid