Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery Ajax Error The Length of the String Exceeds the Value Set on the Maxjsonlength Property in Asp.net

Sep 1, 2015
Introduction

Here I will explain how to solve the problem of  
jQuery ajax 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. Actually this jQuery ajax error will occur whenever our result set data cross json default lenth to fix this problem we need to increase maxJsonLength property default value. 

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.

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 increase default value of MaxJsonLength for that 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>

Once we add above code snippet in web.config file automatically our problem will get solve I hope it helps you…… Happy coding…… 

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.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

2 comments :

Unknown said...

jobnagari

Unknown said...

xvxcvxcvxcvcxvcxvcvcxvxccccccccccccccccccccccccccccccccc

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.