Adi Drumea

Thursday, November 24, 2005

[ASP.NET] Server side viewstate

During the development of an ASP.NET app, I noticed the increasing size of the viewstate as I added more controls to pages. Googled the net a bit and found a way to keep the viewstate on the serverside by overriding SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods of the Page class:
- Create a unique key based on the session id, url and timestamp and use this to store the viewstate in the Cache.
- Register a new hidden field to store this key client-side
- When the viewstate needs to be restored, fetch the key from the page and load it from cache
You may also use Session as it may be kept on SQL Server. Anyway, nice idea, dramatically reduced the size of my pages.

1 Comments:

  • Sie sind dem Experten))) Г¤hnlich cialis preisliste viagra bestellen deutschland [url=http//t7-isis.org]viagra rezeptfrei[/url]

    By Anonymous Anonymous, at 7:38 AM  

Post a Comment

<< Home