How to change maxJsonLength property in web.config

How to change maxJsonLength property in web.config
Introduction:
This article explains 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#.

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>

Once we add above code snippet in web.config file automatically our problem will get solve.

Ashwani
Ashwani

This is a short biography of the post author. Maecenas nec odio et ante tincidunt tempus donec vitae sapien ut libero venenatis faucibus nullam quis ante maecenas nec odio et ante tincidunt tempus donec.

No comments:

Post a Comment