当前位置: 首页 > 编程语言 > C#

iPlanetLDAP和C#PageResultRequestControl分享

时间:2023-04-11 02:35:16 C#

iPlanetLDAP和C#PageResultRequestControl我正在尝试在iPlanetLDAP上进行分页搜索。这是我的代码:LdapConnectionldap=newLdapConnection("foo.bar.com:389");ldap.AuthType=AuthType.Anonymous;ldap.SessionOptions.ProtocolVersion=3;PageResultRequestControlprc=newPageResultRequestControl(1000);string[]param=newstring[]{"givenName"};SearchRequestreq=newSearchRequest("ou=people,dc=bar,dc=com","(ou=MyDivision)",SearchScope.Subtree,param);要求。控制.Add(prc);while(true){SearchResponsesr=(SearchResponse)ldap.SendRequest(req);...snip...}当我运行这个时,我在剪辑之前的行中收到一个异常,指出“服务器不支持控制。控制是关键的”。快速谷歌搜索没有找到任何结果。iPlanet是否支持分页?如果是这样,我做错了什么?谢谢。所有LDAPv3兼容目录必须包含服务器支持的控件的OID列表。可以通过使用空/空搜索根DN发出基本级别搜索来访问该列表,以获取目录服务器根DSE并读取多值supportedControl属性。分页搜索支持的OID是1.2.840.113556.1.4.319。这是让您入门的代码片段:LdapConnectionlc=newLdapConnection("ldap.server.name");//读取RootDSE始终可以匿名完成,但是AuthType//在连接到某些目录时必须设置为Anonymous:lc.AuthType=AuthType.Anonymous;using(lc){//发出带有空搜索基础的基础级搜索请求:SearchRequestsReq=newSearchRequest(null,"(objectClass=*)",SearchScope.Base,"supportedControl");SearchResponsesRes=(SearchResponse)lc.SendRequest(sReq);foreach(sRes.Entries[0].Attributes["supportedControl"].GetValues(typeof(String))){控制台.WriteLine(supportedControlOID);if(supportedControlOID=="1.2.840.113556.1.4.319"){Console.WriteLine("支持寻呼!");}}}我认为iPlanet不支持分页,但这可能取决于您使用的版本。较新版本的Sun产品目录似乎支持分页。您可能最好使用我描述的方法检查您的服务器。以上就是C#学习教程:iPlanetLDAP和C#PageResultRequestControl分享的全部内容。如果对你有用,需要进一步了解C#学习教程,希望大家多多关注。本文收集自网络,不代表立场。如涉及侵权请点击右侧联系管理员删除。如需转载请注明出处: