Export (0) Print
Expand All
Expand Minimize

Page.RegisterRequiresViewStateEncryption Method

Registers a control with the page as one requiring view-state encryption.

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

member RegisterRequiresViewStateEncryption : unit -> unit

ExceptionCondition
InvalidOperationException

The RegisterRequiresViewStateEncryption method must be called before or during the page PreRenderphase in the page life cycle.

If you are developing a custom control that deals with potentially sensitive information, call the RegisterRequiresViewStateEncryption method to register the control with the page and ensure view state for the control is encrypted.

The entire page state will be encrypted if the ViewStateEncryptionMode is set to Auto or Always.

The following code example demonstrates setting the view-state encryption mode for a Page object and requesting encryption of the view state through RegisterRequiresViewStateEncryption. In this example, view state will be encrypted when customer information is retrieved from a database.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft