Storing ViewState on the server

To reduce page bloat, we move view state to session state, rather than store it in hidden fields. This is done by overriding System.Web.UI.Page’s LoadPageStateFromPersistenceMedium() and SavePageStateToPersistenceMedium() methods.

protected override object LoadPageStateFromPersistenceMedium()
return Session[“__ViewState”];

protected override void SavePageStateToPersistenceMedium(object state)
Session[“__ViewState”] = state;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s