Introduction:
Here I will explain how to solve the problem of “Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.” in asp.net using c#, vb.net.
Description:
In previous articles I explained gridview examples in asp.net, dropdownlist examples in asp.net, jQuery regular expression to validate url without http(s), regular expression to validate phone number in jquery, regular expression to replace all special characters with spaces in c#, regex email validation in c# and many articles relating to jQuery, asp.net. Now I will explain how to solve the problem of length of the string exceeds the value set on the maxJsonLength property.” in asp.net.
In previous articles I explained gridview examples in asp.net, dropdownlist examples in asp.net, jQuery regular expression to validate url without http(s), regular expression to validate phone number in jquery, regular expression to replace all special characters with spaces in c#, regex email validation in c# and many articles relating to jQuery, asp.net. Now I will explain how to solve the problem of length of the string exceeds the value set on the maxJsonLength property.” in asp.net.
Generally
this problem occur whenever our json result set length exceeds default json MaxJsonLength property value. By
default MaxJsonLength property will
allow 102400 (100k) in case our string exceeding this length we will get JavaScriptSerializer
error.
To
solve this problem we need to set MaxJsonLength
property value in web.config file like
as shown below
<configuration>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="3000000"/>
</webServices>
</scripting>
</system.web.extensions>
</configuration>
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
1 comments :
I put this code snippet into my web.config, still I am getting the same exception
Note: Only a member of this blog may post a comment.