We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Maximum request length exceeded.

Hi I have a problem when I try to export to excel a grid with more than 4000 records, when I render the grid I have the save problem but I increase MaxJsonLength in Json result, but when I try to export to excel I got  Maximum request length exceeded error

Thanks in advance

Attachment: codegrid_91eab66e.rar

3 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team April 10, 2017 10:52 AM UTC

Hi Jaime, 

Thanks for contacting Syncfusion support. 

We checked in our sample and when we export to excel with more than 4000 records we did not face any maximum request length exceeded error in our sample. For your convenience we attached a sample and please download the sample from the following link 

In your code example we found that you have deserialize the values to get the data. We will face the mentioned issue when we deserialize the more than 5000 records in the Grid. To avoid this issue we need to divide the rows into two or three and serialize the values. After we serialize the values we need to combine the whole data into a list.   

Find the code example:  

for (var i = 0; i < rowPartition; i++)  
   string griddata = serializer.Serialize(rows.Skip(i * 2000).Take(2000));  
   var data = serializer.Deserialize<List<Summary>>(griddata);  
ViewBag.datasource = Data;  

Prasanna Kumar N.S.V 

JA jaime April 10, 2017 05:24 PM UTC

Hi thanks for your response, your grid was ok, My issue was due to IIS's preset upload limit.
Adding the following to web.config resolved the issue.

<httpRuntime executionTimeout="100000" maxRequestLength="214748364" />

Thanks for your support

PK Prasanna Kumar Viswanathan Syncfusion Team April 11, 2017 05:16 AM UTC

Hi Jaime, 

We are happy to hear that your issue has been resolved.  

Please let us know if you need any further assistance. 

Prasanna Kumar N.S.V 

Live Chat Icon For mobile
Up arrow icon