Large

ViewState Size

By aaubry Last update Aug 17, 2011 — Installed 372 times.

Script Summary: Displays a bar that visually indicates the size of the ASP.NET ViewState



Thumb

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 script that helps keeping the ViewState under control by displaying its size in the bottom of every page.