Edit

Share via


SessionPageStatePersister(Page) Constructor

Definition

Initializes a new instance of the SessionPageStatePersister class.

public SessionPageStatePersister(System.Web.UI.Page page);

Parameters

page
Page

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

Exceptions

The HttpSessionState is null (Nothing in Visual Basic)

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

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1