![](/img/trans.png)
[英]how can i get value of all controls created in runtime in C# asp.net
[英]How to get all supported ldap controls in .Net C#
我想知道.Net中是否提供任何api,以獲取給定域的所有受支持的ldap控件? 在“ Ldp”實用程序中,當我們綁定到某些域時,我們可以看到所有受支持的ldap控件OID。 我希望通過.Net獲得此列表。 或者有可能在提供控件的OID時檢查是否支持某些ldap控件。
有文檔告訴您支持哪些LDAP控件:
http://msdn.microsoft.com/zh-CN/library/aa813628(v=vs.85).aspx
我從stackoverflow線程之一得到了答案。 iPlanet LDAP和C#PageResultRequestControl
LdapConnection lc = new LdapConnection("ldap.server.name");
// Reading the Root DSE can always be done anonymously, but the AuthType
// must be set to Anonymous when connecting to some directories:
lc.AuthType = AuthType.Anonymous;
using (lc)
{
// Issue a base level search request with a null search base:
SearchRequest sReq = new SearchRequest(
null,
"(objectClass=*)",
SearchScope.Base,
"supportedControl");
SearchResponse sRes = (SearchResponse)lc.SendRequest(sReq);
foreach (String supportedControlOID in
sRes.Entries[0].Attributes["supportedControl"].GetValues(typeof(String)))
{
Console.WriteLine(supportedControlOID);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.