How to configure maxJsonLength in ASP.NET AJAX applications
How to configure maxJsonLength in ASP.NET AJAX applications
The maximum length of JSON strings, by default is 2097152 characters, which is equivalent to 4 MB of Unicode string data. This should be good enough for most of the web applications. If the size of serialized data you want to send to the client is larger than this default value, you may change it either programmatically or declaratively (in the web.config file of the web site). However, I personally wouldn't go over the 4MB threshold because serializing a large chunk of data across the wire normally causes huge performance penalty. From my experience, you may want to take a serious look at your application design if you need JSON strings longer than 2097152 characters.
To set this value in your code, you can simply assign an integer to the JavaScriptSerializer.MaxJsonLength property. Alternatively, you can configure the max length in the system.web.extensions configuration section in web.config. The example below sets the maxJswonLength value to 500000 characters. Also bear in mind that the maxJsonLength in the web.config file automatically overrides the JavaScriptSerializer.MaxJsonLength property.
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions><system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
http://geekswithblogs.net/frankw/archive/2008/08/05/how-to-configure-maxjsonlength-in-asp.net-ajax-applications.aspx
To set this value in your code, you can simply assign an integer to the JavaScriptSerializer.MaxJsonLength property. Alternatively, you can configure the max length in the system.web.extensions configuration section in web.config. The example below sets the maxJswonLength value to 500000 characters. Also bear in mind that the maxJsonLength in the web.config file automatically overrides the JavaScriptSerializer.MaxJsonLength property.
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions><system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
http://geekswithblogs.net/frankw/archive/2008/08/05/how-to-configure-maxjsonlength-in-asp.net-ajax-applications.aspx
Permissions in this forum:
You cannot reply to topics in this forum
|
|