Is it any limit for POST data size in Ajax?
Solution 1:
JSON has a maximum length! I need to increase this value. In web.config add the following:
<appSettings>
<add key="aspnet:MaxJsonDeserializerMembers" value="150000" />
</appSettings>
Solution 2:
Is it any POST Limit in Ajax?
No, the HTTP specification doesn't impose a specific size limit for posts. However it depends on the Web Server which you are using or the programming technology used to process the form submission.
In ASP.NET MVC you can try this:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1000000" />
</requestFiltering>
</security>
Solution 3:
The HTTP spec doesn't defining a limitation of POST data size.
But using ASP.NET MVC, there could be a POST data limitation, try to increase it in your Web.Config file:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1000000" />
</requestFiltering>
</security>
From MSDN:
Specifies the maximum length of content in a request, in bytes. The default value is 30000000.
Solution 4:
This solved my problem:
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647" />
</webServices>
</scripting>
</system.web.extensions>
Solution 5:
IF there is a client-side limit then it would be browser specific but the HTTP spec does not define a limitation of POST data size.
Keep in mind that a POST is merely bytes across the network so the more fields you are posting then the longer it can take to upload that data.
A 1MB POST is going to make the user feel like the form is broken and unresponsive if using a traditional form submit.
If there are a lot of fields to serialize()
then AJAX could hang up the browser while it collects all of the data. I think browsers do have a memory limit for JavaScript overall so if you hit that limit then the AJAX process will fail.
// wanna have some fun?
var html = '<div></div>';
for(var i = 0; i < 1000000; i++){
html += html;
}
Your best bet is to increase the maximum allowable POST size on the server-side to avoid issues.
Most commonly issues arise when people make an upload script which simply seems to hang while the user is confused why their 3MB pictures are going slow on a 125KB/s upload link.