Wednesday 30 June, 2010

Chunking Viewstate

One interresting feature a developer should know is the ability to chunk the viewstate field into multiple fields. Why you

need such feature? Some proxy servers and firewalls won't allow a request to be processed if a hidden fields' length is

large. To overcome this, You can set up in the web.config file for all the pages to have a maximum viewstate field.





The value of maxPageStateFieldLength is in Bytes.

In this way, if the hidden viewstate field is larger than 1 kb, ASP.NET will create multiple hidden viewstate field to hold

the data entered by the user before the postback. For example if the size of the data entered by the user is 2KB, the below

fields in the page once being rendered to HTML will be created





Keep in mind that this won't improve the application performance. It will add more steps to serialize the data back before

being sent to the client.

Hope this helps,

No comments:

Post a Comment