Page.SavePageStateToPersistenceMedium(Object) Page.SavePageStateToPersistenceMedium(Object) Page.SavePageStateToPersistenceMedium(Object) Page.SavePageStateToPersistenceMedium(Object) Method


Saves any view-state and control-state information for the page.

protected public:
 virtual void SavePageStateToPersistenceMedium(System::Object ^ state);
protected internal virtual void SavePageStateToPersistenceMedium (object state);
abstract member SavePageStateToPersistenceMedium : obj -> unit
override this.SavePageStateToPersistenceMedium : obj -> unit
Protected Friend Overridable Sub SavePageStateToPersistenceMedium (state As Object)


Object Object Object Object

An Object in which to store the view-state information.


The SavePageStateToPersistenceMedium method uses the Save method of the System.Web.UI.PageStatePersister object referenced by the PageStatePersister property to store view-state and control-state information for the page.

ASP.NET includes two descendents of the PageStatePersister class, the HiddenFieldPageStatePersister class that saves state information in a hidden field included in the ASP.NET page, and the SessionPageStatePersister class that saves state in the Session object associated with the request. Note that when using the SessionPageStatePersister class the hidden VIEWSTATE field is still rendered as this is used to determine post back.

To save state in the location of your choice, you should create a new descendent of the PageStatePersister class that saves and loads state to the persistence medium of your choice. For an example of creating a new PageStatePersister object, see the PageStatePersister class.

If you are using the .NET Framework version 1.0 or 1.1, override this method if you want to save the Page state in anything other than a hidden field. If you choose to do so, you must also override the LoadPageStateFromPersistenceMedium method.

Applies to

See also