Home > Asp.net MVC > MaxJsonLength exception in ASP.NET MVC during JavaScriptSerializer

MaxJsonLength exception in ASP.NET MVC during JavaScriptSerializer

Problem Statement
The following exception (error) occurs in ASP.NET when AJAX calls are made to PageMethod using jQuery AJAX or ScriptManager
Error during serialization or deserialization using the JSON JavaScriptSerializer.
“The length of the string exceeds the value set on the maxJsonLength property.”
Below code that helped to resolve the issue. Instead of using JsonResult replaced it with Content Result and set the javaScriptSerializer with MAXJsonLength.

Code:

 

This Article is TAGGED in , . BOOKMARK THE permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">