Senator Guerra Souty original series calendar,replica hublot blue steel peach pointer collocation of rolex replica Rome digital scale, track type minute replica watches scale shows that the classical model is swiss replica watches incomparable, wearing elegant dress highlights.
mr-ponna.com

 

YOU ARE HERE: HOME Questions Is it possible to store view state in server side



Server Side View state

View(s): 19535

Is it possible to store view state in server side?

Answer 1)

Yes, we can implement server side viewstate.

For this we have to override two virtual methods LoadPageStateFromPersistenceMedium() and SavePageStateToPersistenceMedium() of System.Web.UI.Page (on your aspx page)

However, it is not straightforward, because a user can visit a page in browser, hit the back button to a previous page and push a button (which would require the viewstate for that page). We have to handle such scenarios carefully.

Sample code:

//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();
    }
}

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);
    }
}

  Asked in:  Mahindra Satyam   Expertise Level:  Experienced
  Last updated on Tuesday, 21 February 2012
3/5 stars (7 vote(s))

Register Login Ask Us Write to Us Help