程式碼如下
string AD_RootPath = "LDAP://AD的IP或是電腦名稱/cn=Users,dc=網域,例:example,dc=網域,例:com";
DirectoryEntry entry = new DirectoryEntry(AD_RootPath, 帳號,密碼, AuthenticationTypes.Secure);
DirectorySearcher deSearch = new DirectorySearcher(entry);
foreach (SearchResult res in deSearch.FindAll())
{
foreach (string key in res.Properties.PropertyNames)
{
foreach (object val in res.Properties[key])
{
string v=key+"="+val;
Response.Write(v + "<BR>");
}
}
Response.Write( "------------------------------------------------------------------------------------------------<BR>");
}
文章標籤
全站熱搜
留言列表