SessionPageStatePersister Constructor (Page)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Initializes a new instance of the SessionPageStatePersister class.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public SessionPageStatePersister(
	Page page


Type: System.Web.UI.Page

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

Exception Condition

The HttpSessionState is null (Nothing in Visual Basic)

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

.NET Framework
Available since 2.0
Return to top