繁体   English   中英

如何在.Net C#中获取所有受支持的ldap控件

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM