Page::RegisterRequiresViewStateEncryption Method ()

 
System_CAPS_noteNote

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

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

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

public:
void RegisterRequiresViewStateEncryption()

Exception Condition
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
Available since 2.0
Return to top
Show: