List users and groups from ActiveDirectory in ASP.NET page?

  • Thread starter Thread starter TK
  • Start date Start date
T

TK

How can I show a list of OS users and groups in an ASP.NET page?
Is there MSDN or SDK articles?

please help.
TK
 
the System.Directoryservices namespace is the one you are after.

There is a whole sheaf od stuff on it on MSDN adn a couple of good articles
on www.4guysfromrolla.com
hope this helps
M
 
Thank you Martin.
Today I've learned about System.DirectoryServices as you pointed, and I
succeeded to get a list of AD objects in //domain/Users. My current code is
as following.

using System;
using System.Security;
using System.DirectoryServices;

namespace users
{
public class listUsers
{
public static int Main()
{
DirectoryEntry entries =
new DirectoryEntry("LDAP://CN=Users,DC=mydom,DC=local");

foreach(DirectoryEntry ent in entries.Children)
{
Console.WriteLine("{0} {1}", ent.Name, ent.Path);
}
return 0;
}
}
}

Above program show me a complete list of users and groups which are exist in
//mydom.local/Users. But I still haven't understood clearly. I want to
distinguish group or user object from the entries.Children list.
How can I do it? What the things I should learn about?

TK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top