Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am having problem while post large amount of data in ajax request

Check Below Code
JavaScript
var jsonPostData = {
    p_HTML: $("#div").html(),
    p_FromDate: $("#dpFrom").val(),
    p_ToDate: $("#dpTo").val()
}
$.ajax({
    url: "url",
    contentType: "application/json; charset=utf-8",
    type: "post",
    dataType: "json",
    data: JSON.stringify(jsonPostData),
    success: function (result) {
                },
    error: function (a, b, c) {
    }
});


The Ajax Post will Send data to controller method
like /Conroller/Method/
I Add jsonSerialization in web.confige but its not working

I also tried
XML
<appSettings>
<add key="maxJsonLength" value="52428800" />
</appSettings>


but not working

I am getting error

Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
Parameter name: input

Request header something like

CSS
Accept  application/json, text/javascript, */*; q=0.01
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Content-Length  3566924
Content-Type    application/json; charset=utf-8

.................
Posted
Updated 22-Sep-20 8:17am
v4

The default maximum length is 4MB - you can change that via web.config (jsonSerialization Element[^], however you better consider what you are sending over the network as it's affect you application performance...
 
Share this answer
 
Comments
dipak _kansara 19-Dec-14 0:05am    
Actually the ajax call will not consume web service it will call controller method so jsonSerialization key will not be use
Es Así como se configura en el web.config

<security>
<requestfiltering>
<requestlimits maxallowedcontentlength="4294967295">

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900