iPlanet LDAP and C# PageResultRequestControl

前端 未结 1 701
死守一世寂寞
死守一世寂寞 2020-12-04 02:49

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 = AuthTyp         


        
相关标签:
1条回答
  • 2020-12-04 03:17

    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.

    The OID for paged search support is 1.2.840.113556.1.4.319.

    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!");
        }
      }
    }
    

    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.

    0 讨论(0)
提交回复
热议问题