MikeTWebb
MikeTWebb

Reputation: 9279

MVC3 using LDAP DirectorySearcher

I have a C#.Net MVC2 web app. We are loading a partial view with the results of a search on our LDAP directory. However, the max number of return result items is 1000. In other words, if I type "b" into the search box, only one thousand rows are returned from LDAP. It's causing some confusion. One of our users entered "b" as they were looking for Butamos. The list ended at Bond.

Here's the code. Is there a way to specify returning an unlimited number of result rows?

ViewBag.people = new DirectorySearcher(
                        new DirectoryEntry("LDAP<stuff>),
                        formattedSearchString,
                        new string[] { "displayname", "mail", "msExchHomeServerName", "homeServer" })
                .FindAll());

Upvotes: 0

Views: 597

Answers (1)

JPBlanc
JPBlanc

Reputation: 72680

This is a normal behaviour of the Active-Directory (and generally LDAP servers). You can replace with a paged search (look here), but the best practice is to add a search filter to reduce the number of returned objects.

Upvotes: 1

Related Questions