We can easily override the two famous methods for persisting viewstate at server side.
1. LoadPageStateFromPersistenceMedium()
2.SavePageStateToPersistenceMedium()

1.
What all precautions do we need to keep when we are implementing such solution ?
1. How about storing in session.
2. How about the situation when the page is opened from browser history and a button is pressed. How will we retrieve the view state information of this page.
3. If user click back button and clicks on any control ( similar to above case )
3. Examples for LoadPageStateFromPersistenceMedium()
//overriding method of Page class
protected override object LoadPageStateFromPersistenceMedium()
{
//If server side enabled use it, otherwise use original base class implementation
if (ConfigurationManager.AppSettings[“ServerSideEnabled”].Equals(“true”))
{
//Your implementation here.
}
else
{
return base.LoadPageStateFromPersistenceMedium();
}
}
4.
Examples for SavePageStateToPersistenceMedium
protected override void SavePageStateToPersistenceMedium(object state)
{
//If server side enabled use it, otherwise use original base class implementation
if (ConfigurationManager.AppSettings[“ServerSideEnabled”].Equals(“true”))
{
//Your implementation here.
}
else
{
base.SavePageStateToPersistenceMedium(state);
}
}