adhanlon
adhanlon

Reputation: 6529

Is there a way to get a list of all the users on a domain using ASP.NET with C# as the backend?

The question basically says it all. I want to be able to get a list of all the users on the windows domain (i.e. in the active directory) using c#.

Thanks!

Upvotes: 5

Views: 755

Answers (1)

John K.
John K.

Reputation: 5474

var dirEntry = new DirectoryEntry(string.Format("LDAP://{0}/{1}", "x.y.com", "DC=x,DC=y,DC=com"));
var searcher = new DirectorySearcher(dirEntry)
         {
             Filter = "(&(&(objectClass=user)(objectClass=person)))"
         };
var resultCollection = searcher.FindAll();

SEE: Get all users from AD domain

Upvotes: 5

Related Questions