Click here to Skip to main content
13,558,932 members
Click here to Skip to main content
Add your own
alternative version


4 bookmarked
Posted 4 Jun 2013
Licenced CPOL

Accessing ADS User's

, 4 Jun 2013
Rate this:
Please Sign up or sign in to vote.
How to access Active Director users on a WinNT network and show them in a dropdown list.


This article explains how to access Active Directory users on a WinNT Network and show them in a dropdown list.


We have many small ASP.NET applications in my firm that all have their own Forms Authentication and authorization, so managing the users for each application has become complex. I decided to bring all the applications into one portal like application and use ADS for authentication but application wise - Role Wise Authorization. It was pretty simple and straight for authentication but using an Oracle database was a bit challenging. Here I m not going to put the whole application if required or if demanded by people.

Using the code 

It is just for understanding and as a start up for accessing ADS records

using System.DirectoryServices; 

private IEnumerable<string> GetADSUserList(string strLDAP)
    DirectoryEntry directoryEntry = new DirectoryEntry(strLDAP);
    List<string> usernames = new List<string>();
    foreach (DirectoryEntry child in directoryEntry.Children)
        if (child.SchemaClassName == "User")
    return usernames;

protected void Page_Load(object sender, EventArgs e)
    DropDownList1.DataSource = GetADSUserList("WinNT://");

Hope this will be a good point to start.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

V R Shukla
Technical Lead
India India
This member doesn't quite have enough reputation to be able to display their biography and homepage.

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01-2016 | 2.8.180515.1 | Last Updated 4 Jun 2013
Article Copyright 2013 by V R Shukla
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid