4

I am experiencing a strange error (not very strange, i guess it is because of some maximum length restriction i might not know about). I am working on a Custom Server Control, which renders a Custom Search Service for employees. When the employees are searched successfully, I fetch their whole objects (List) from WCF service in json, keep the string in a hidden field, and postback for the code behind to fetch json string and deserialize into objects. Now, up to 2000 objects, it was working flawlessly, but when the search criteria started fetching above 2000, the following error started occuring

Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0 

I debugged the code as well, but the c# code was not even catching any calls. I also tried keeping the json strings of objects in multiple hidden fields with each having 1000 records in json string. But still, the error keep coming up. This tells me there is some sort of restriction of maximum size to the form. Can i get any solution for this problem, or do I have to go with sending Ids to the code behind and fetching the Objects from the Service there? Actually, the service url is supposed to be dynamic, the host application would be providing it, so I am trying not to introduce any service binding on C# level(you get the idea, i guess).

Taha Rehman Siddiqui
  • 2,441
  • 5
  • 32
  • 58
  • I would suggest this is not the best approach to take. When searching for something would you really want to even show more than x (say 100) people? Any more should be paged in / out because the user isn't going to scroll through 5,000+?! – Belogix Mar 26 '13 at 15:51
  • no no, you didnt get me, i meant there is an option of selecting all employees falling in the search criteria, that are not even on the page(paging is implemented through scrolling down), in that case i have to make all the employees selected, available in a public property exposed by the custom control. – Taha Rehman Siddiqui Mar 26 '13 at 19:20

2 Answers2

5

ASP.NET does have a maximum request size-- it is 4MB by default, according to the documentation. If you think you might be hitting that limit, you can increase it by adding the following to your web.config file inside the <system.web> tag:

<httpRuntime maxRequestLength="x">

where x is the desired maximum in Kilobytes. So for example, 10240 would be 10MB.

Brian Rogers
  • 125,747
  • 31
  • 299
  • 300
1

I ran into this problem when I was passing back and forth a large amount of data for mapping - I was losing the data after it got too large. I made some changes to the web.config:

 <appSettings>    
     <add key="aspnet:MaxHttpCollectionKeys" value="5000" />
     <add key="aspnet:MaxJsonDeserializerMembers" value="5000" />
</appSettings>
jiiri
  • 330
  • 1
  • 12