I get the following error when playing with JSON request:
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
This is the jQuery code:
//load partial view contain grid
$('#rptProductsRates').load('@Url.Action("ProductsRatesFlipPagination", "Reports")', { flipPagination: true }, function (data) {
if (data.toString().substr(0, 15) == "<!DOCTYPE html>") {
window.location = '@Url.Action("ProductsRates", "Reports")';
}
else {
debugger;
var resultError = data.toString().substr(0, 9);
if (resultError == "<!DOCTYPE") {
var exceptionURL='@Url.Content("~/Reports/Exception?controller=Reports&action=ProductsRates")';
window.location = exceptionURL;
//unblock the UI
$.unblockUI();
}
else {
$('#contentDiv').show();
//unblock the UI
$.unblockUI();
var bottomMarginFirst = (screen.height * .29)
var bottomMargin = (screen.height * .42)
if ($('.renderBody').height() <= ($(document).height() - bottomMarginFirst)) {
$('.renderBody').css({ 'height': ($(document).height() - bottomMargin + @System.Configuration.ConfigurationManager.AppSettings["GridHeight"] - 100) })
}
}
}
What's the cause and a possible solution to this error?