5,695,118 members and growing! (14,639 online)
Email Password   helpLost your password?
Web Development » ASP.NET » General     Intermediate

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

By Softomatix

An article on using DirectoryServices namespace to enumerate Active Directory Users
C#, VC7, C++Windows, .NET, .NET 1.0, Win2K, WinXP, ASP.NET, Visual Studio, Dev

Posted: 10 Feb 2002
Updated: 10 Feb 2002
Views: 156,686
Bookmarked: 62 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
17 votes for this Article.
Popularity: 3.05 Rating: 2.48 out of 5
8 votes, 50.0%
1
1 vote, 6.3%
2
2 votes, 12.5%
3
1 vote, 6.3%
4
4 votes, 25.0%
5

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


To learn more about us, Please visit us at http://www.netomatix.com
Occupation: Web Developer
Location: United States United States

Other popular ASP.NET articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 9 of 9 (Total in Forum: 9) (Refresh)FirstPrevNext
GeneralNot very helpfulmemberknuteski10:31 12 Nov '07  
GeneralRuntime errormemberNew_Beau13:23 13 Oct '07  
GeneralComputer informationmembermarker275:04 4 Mar '06  
Questionhow to get my pc infomemberJwalant Natvarlal Soneji20:50 21 Dec '05  
AnswerRe: how to get my pc infomemberSuNNySiDeDowN13:23 10 Apr '07  
GeneralRe: how to get my pc infomemberJwalant Natvarlal Soneji17:28 11 Apr '07  
Generalrecorrer resultmemberelPooldotNET5:11 25 May '05  
GeneralSystem show error messagememberpengyou4:46 4 Apr '04  
General** The server is not operationalmemberx0n3:44 1 Apr '03  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 10 Feb 2002
Editor: Paul Watson
Copyright 2002 by Softomatix
Everything else Copyright © CodeProject, 1999-2008
Web17 | Advertise on the Code Project