Antoine Aubry

Reinventing the wheel since 1990

17. August 2011 03:04
by aaubry
0 Comments

Controlling ViewState size

17. August 2011 03:04 by aaubry | 0 Comments

For those of you still using ASP.NET Web Forms, here is a handy utility. The ViewState is a handy mechanism of ASP.NET that allows a page to preserve state between postbacks. The default implementation stores the content of the ViewState in a hidden field that is included in the page. When a postback occurs, the value of that field is sent back to the server, allowing it to recover its previous state.

However useful the ViewState may be, it may cause some problems. If too much data is stored in it, it can grow out of control and significantly slow down the page loads. I have created a GreaseMonkey script that helps keeping the ViewState under control by displaying its size in the bottom of every page.

ViewStateSize

Download the script here

Download the script on userscripts.org

blog comments powered by Disqus