Note this question is not duplicate of MVC 5 Increase Max JSON Length in POST Request and Can I set an unlimited length for maxJsonLength in web.config?.
I have a big JSON that I want to send via POST request from client to an action in MVC controller.
I've got this error:
The length of the string exceeds the value set on the maxJsonLength property. Parameter name: input
I noticed that my controller's constructor is called and the error is raised in default MVC model binders. Also I checked the call stack and I saw the error raised in JsonValueProviderFactory in System.Web.Mvc namespace.
It is clear that below code in web config has no effect because in JsonValueProviderFactory class it has used JavaScriptSerializer without setting any value for MaxJsonLength and the default value is 2097152 bytes:
<jsonSerialization maxJsonLength="2147483647"></jsonSerialization>
One way is rewriting the JsonValueProviderFactory class and set javaScriptSerializer.MaxJsonLength manually as it is mentioned Here.
So my question is How can I change default value of MaxJsonLength in JsonValueProviderFactory class in System.Web.Mvc namespace without rewriting the class. Can we say it is a bug in the class?
Any help would be appreciated.