LDAP的iPlanet和C#PageResultRequestControl [英] iPlanet LDAP and C# PageResultRequestControl

查看:194
本文介绍了LDAP的iPlanet和C#PageResultRequestControl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做上的iPlanet LDAP分页搜索。这里是我的code:

I am trying to do a paged search on an iPlanet LDAP. Here's my code:

LdapConnection ldap = new LdapConnection("foo.bar.com:389");
ldap.AuthType = AuthType.Anonymous;
ldap.SessionOptions.ProtocolVersion = 3;
PageResultRequestControl prc = new PageResultRequestControl(1000);
string[] param = new string[] { "givenName" };
SearchRequest req = new SearchRequest("ou=people,dc=bar,dc=com", "(ou=MyDivision)", SearchScope.Subtree, param);
req.Controls.Add(prc);
while (true)
{
    SearchResponse sr = (SearchResponse)ldap.SendRequest(req);
    ... snip ...
}

当我运行它,我得到了美国例外服务器不支持控制,控制是至关重要的关于喀嚓前行。快速谷歌搜索变成了什么。是否支持的iPlanet分页?如果是这样,我究竟做错了什么?谢谢你。

When I run this, I get an exception that states "The server does not support the control. The control is critical" on the line before the snip. Quick Google search turns up nothing. Does iPlanet support paging? If so, what am I doing wrong? Thanks.

推荐答案

所有LDAP兼容V3目录必须包含服务器支持的OID的控件的列表。该列表可以通过发出带有空/空搜索根DN获得目录服务器根DSE基本级别的搜索和阅读多值 supportedControl -attribute访问。

All LDAP v3 compliant directories must contain a list of OIDs for the controls that the server supports. The list can be accessed by issuing a base-level search with a null/empty search root DN to get the directory server root DSE and reading the multi-value supportedControl-attribute.

有关分页的搜索支持的OID是<一个href=\"http://www.oid-info.com/cgi-bin/display?oid=1.2.840.113556.1.4.319&submit=Display&action=display\">1.2.840.113556.1.4.319.

The OID for paged search support is 1.2.840.113556.1.4.319.

下面是一个code片段,让你开始:

Here's a code snippet to get you started:

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);
    if (supportedControlOID == "1.2.840.113556.1.4.319")
    {
      Console.WriteLine("PAGING SUPPORTED!");
    }
  }
}

我不认为的iPlanet支持分页但这可能取决于你使用的版本。太阳制作目录的新版本似乎支持分页。你可能最好还是使用我所描述的方法检查你的服务器。

I don't think iPlanet supports paging but that might depend on the version you're using. Newer versions of Sun-made directories seem to support paging. You're probably best off checking your server using the method I've described.

这篇关于LDAP的iPlanet和C#PageResultRequestControl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆