Any way to disable paging?

Mar 2, 2012 at 2:47 PM
Hi, when querying a LDAP server I get the exception "The server does not support the control. The control is critical." The control requested is the pagedResultsControl (1.2.840.113556.1.4.319). Can I disable the addition of the paging control somehow? /David
Mar 4, 2012 at 3:43 AM

I can add this as a feature, but keep in mind it effectively breaks several of the capabilities of LINQ to LDAP.

First, FirstOrDefault, Single, SingleOrDefault, and Take all rely on paging to function.  It also opens up the possibility of exceeding the server's max size limit.  Can you tell me which directory server you are using?

Mar 4, 2012 at 7:18 AM
Edited Mar 4, 2012 at 7:18 AM

Just being nosey but what directory server are you using that doesn't support paging?

Mar 5, 2012 at 10:22 AM
Edited Mar 5, 2012 at 11:36 AM

Now I have been in contact with the administrator of the directory and it is a Novell EDirectory I am awaiting an answer whether paging is not supported at all or if it must be enabled.

I am having another problem at another client that also might be related to paging. This is the stacktrace: 


Object reference not set to an instance of an object.
   at LinqToLdap.QueryCommands.StandardQueryCommand.HandleStandardRequest(DirectoryConnection connection, TextWriter log) in C:\Users\ahatter\Documents\Visual Studio 2010\Projects\linqtoldap\Trunk\LinqToLdap\QueryCommands\StandardQueryCommand.cs:line 71
   at LinqToLdap.QueryCommands.StandardQueryCommand.Execute(DirectoryConnection connection, SearchScope scope, TextWriter log) in C:\Users\ahatter\Documents\Visual Studio 2010\Projects\linqtoldap\Trunk\LinqToLdap\QueryCommands\StandardQueryCommand.cs:line 44
   at LinqToLdap.DirectoryQueryProvider.Execute(Expression expression) in C:\Users\ahatter\Documents\Visual Studio 2010\Projects\linqtoldap\Trunk\LinqToLdap\DirectoryQueryProvider.cs:line 57
   at LinqToLdap.QueryProvider.Execute[TResult](Expression expression) in C:\Users\ahatter\Documents\Visual Studio 2010\Projects\linqtoldap\Trunk\LinqToLdap\QueryProvider.cs:line 72
   at LinqToLdap.QueryableExtensions.ToList[TSource](IQueryable`1 source) in C:\Users\ahatter\Documents\Visual Studio 2010\Projects\linqtoldap\Trunk\LinqToLdap\QueryableExtensions.cs:line 398


In this case the we're also talking to an EDirectory, but behind a Squid reverse proxy. When I look at the traffic with Wireshark the server returns the expected data but the response does not contain the paging control. I guess that is what is causing the null ref exception.

This is the method that executed the code:


public TEntity[] Execute(string text) {
    using (var context = CtxFactory()) {
        var filterBy = string.Format(FilterFormat, text);
        Log.Debug("Executing query Filter: '{0}' Mappingdata: {1}", filterBy, Mapper);
        var result = context.Query(Mapper.NamingContext, objectClass: Mapper.ObjectClass)

        Log.Debug("Query returned {0} entities", result.Length);
        return result;


The logged debug message: Executing query Filter: '(&(cn=testusrgw2))' Mappingdata: Class='person' Context='ou=Users,ou=Adm,o=meta' Attributes='description, cn, mail'

Edit: Forgot to mention I'm using version of LinqToLdap, from NuGet.

Mar 6, 2012 at 12:19 PM

I think you're right. I should treat an absent PageResultResponseControl as having no more results.  I'll create a bug for this.