I've following code in MVC. In my POST action params
will have huge data. So, I changed web.config
accordingly but, I'm getting ERROR. Actual problem is controller is not even hitting when POST is called.
I tried Following ways
- Override JsonResult
- followed Link. Here i couldn't see data which is sent from script. I'm getting NULL in
base64
.
controller.cs
[System.Web.Mvc.HttpPost]
public bool postImage(string base64)
{
return true;
}
web.config
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483644"/>
</webServices>
</scripting>
JavaScript
$.ajax({
type: "POST",
url: 'http://localhost:21923/communities/postImage?base64=',
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
dataType: "json",
success: function(data) {
document.getElementById('test').click();
},
error: function(a, b, c) {
console.log(a);
}
})
Error
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.\r\nParameter name: input