SessionPageStatePersister(Page) SessionPageStatePersister(Page) SessionPageStatePersister(Page) Constructor

Definition

Initializes a new instance of the SessionPageStatePersister class.

public:
 SessionPageStatePersister(System::Web::UI::Page ^ page);
public SessionPageStatePersister (System.Web.UI.Page page);
new System.Web.UI.SessionPageStatePersister : System.Web.UI.Page -> System.Web.UI.SessionPageStatePersister

Parameters

page
Page Page Page

The Page that the view state persistence mechanism is created for.

Exceptions

Examples

The following code example demonstrates how you can write a PageAdapter class to return an instance of the SessionPageStatePersister class to save view state to the server-side session object.

namespace Samples.AspNet.CS {

    using System.Web.UI;

    public class MyPageAdapter : System.Web.UI.Adapters.PageAdapter {

        public override PageStatePersister GetStatePersister() {
            return new SessionPageStatePersister(Page);
        }
    }
}
Imports System.Web.UI

Namespace Samples.AspNet.VB

    Public Class MyPageAdapter
       Inherits System.Web.UI.Adapters.PageAdapter


       Public Overrides Function GetStatePersister() As PageStatePersister
          Return New SessionPageStatePersister(Page)
       End Function 'GetStatePersister

    End Class

End Namespace

Applies to