It's Microsoft's World, and I'm just living in it
View Clarence Klopfstein's profile on LinkedIn

Clarence Klopfstein's Facebook profile

This site is under construction...


New Comments

Referring Sites


  • This is MY blog. The views represented here are not in relation to anybody else. Please read my full disclaimer for a more complete disclaimer.

Project In Review – Reducing ViewState

November 25, 2009 03:00 by ckincincy

In a .NET world ViewState can get out of hand in a hurry.  In some of our more intense pages the ViewState created by controls could reach well into the 50% range of the page size.  A brief search by a coworker found this solution.

The main thing to take from this article is to insert this snippet of code in your page, or custom base page:

    protected override PageStatePersister PageStatePersister
            return new SessionPageStatePersister(this);

This little beauty of code can reduce the ViewState by 90+%, which is significant.

Now the obvious limitation to this is that your real ViewState is now stored in session, so this will add some overhead to your web application.

Comments are closed