I got the following error message on submitting HTML form containing a lot of data. I have added web.config settings as suggested in this answer, but the error remains.
"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property."
What am I possibly missing? How to check current maxJsonLength setting during debug? (to validate whether or not the web.config setting is applied or ignored).
View (the HTML form) :
using (Html.BeginForm("Submit", "Form", FormMethod.Post, new { @id = "submitForm", @enctype = "multipart/form-data" }))
{
....
}
Javascript (on button submit clicked) :
document.getElementById('submitForm').submit();
Controller :
[ValidateInput(false)]
public ActionResult Submit(EprocModel eprocModel)
{
....
}
Global.asax (where the error appeared) :
On submitting the form in debug mode, breakpoint at the beginning of controller method Submit()
doesn't hit. Instead, execution enters Application_Error()
in global.asax with error.Message
value containing the error message posted above. And at this point, I checked that RequestContext's Content Length is 31325596, still below maxJsonLength
set in web.config :
private void Application_Error(object sender, EventArgs ea)
{
var error = Server.GetLastError();
....
}