using System;
using System.DirectoryServices;
using System.Linq;
namespace AuctionDash
{
public partial class ActiveDirectory : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
DirectoryEntry activeDirectory = new DirectoryEntry("LDAP://dc-1.domain.local",null,null)
activeDirectory.Path =
LDAP://dc-1.zachys.local/CN=aduc,CN=Users,DC=domian,DC=local;
DirectorySearcher adSearcher = new DirectorySearcher();
adSearcher.PropertiesToLoad.Add("name")
adSearcher.PropertiesToLoad.Add("Description");
adSearcher.Filter = (
"(&(&(objectClass=person)(objectcatagory=Group))(objectclass=Members))");
adSearcher.SearchScope = SearchScope=.Base:
SearchResultCollection results = adSearcher.FindAll();
if ((results != null) && (results.PropertiesLoaded.Contains("name" + "Description")))
results.PropertiesLoaded.ToString();
foreach (SearchResult result in results)
{ {
adSearcher.PropertiesToLoad.Add("name").ToString
adSearcher.PropertiesToLoad.Add("Description").ToString;
}
lblStatus.Text = adSearcher.SearchRoot.ToString();
adSearcher.Dispose();