简体   繁体   English

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

[英]How to get all supported ldap controls in .Net C#

I want to know is there any api provided in .Net to get all supported ldap controls for given domain ? 我想知道.Net中是否提供任何api,以获取给定域的所有受支持的ldap控件? In 'Ldp' utility when we bind to certain domain we get to see all supported ldap controls OID. 在“ Ldp”实用程序中,当我们绑定到某些域时,我们可以看到所有受支持的ldap控件OID。 I want this list through .Net. 我希望通过.Net获得此列表。 Or is it possible that check if certain ldap control is supported when OID of control is provided. 或者有可能在提供控件的OID时检查是否支持某些ldap控件。

There's documentation that tells you which LDAP controls are supported: 有文档告诉您支持哪些LDAP控件:

http://msdn.microsoft.com/en-us/library/aa813628(v=vs.85).aspx http://msdn.microsoft.com/zh-CN/library/aa813628(v=vs.85).aspx

I got answer from one of the stackoverflow thread. 我从stackoverflow线程之一得到了答案。 iPlanet LDAP and C# PageResultRequestControl 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