Search code examples
asp.netjsonupdatepanelcomponentartjsonserializer

UpdatePanel seems to struggle with huge data as AsynPostBack. jSonSerializer maxLength doesn't help


I have a ASP.NET 3.5 App and trying to update a Update Panel which has a nested custom control. In that custom control is a ComponentArt Gird, which gets filled by almost 13MB of Data (Yes, I could chunck that...) at this Update.

I have a hidden button wihtin the update Panel, which I trigger by JS from client side, when I need the updatePanel and the grid.

When I call the Update method during the asyncPostback with Updatepanelxyz.Update() then I get later in the process a asyncPostBackError saying, that the JSonSerializer can't hanlde this amount of data. I should increase the specified value.

Indeed. Understood. But when I change this value in the web.config, then it does only work until round about 8MB, but not more. Is there a limit for the JSonSerializer in that case. I've set the value to the maximum value of Int32, which is kind of the 1000x of the default value, which is already enough for 4MB of serialized data.

Any suggestions? Any way to force the serializer to make that happen? Any way to use another Serializer?

Cheers, Steve


Solution

  • Your best bet is to change the ScriptingJsonSerializationSection.MaxJsonLength Property in your web.config section.

    It defaults to 102400 characters, in contrast to the JsonSerializer class' limit of 2097152 characters.

    See:

    JsonSerializer class maxJsonLength property

    and

    JsonSerialization configuration section max length property

    As I mentioned above, changing the configuration section property is the only way to go unfortunately.