ViewStateEncryptionMode Enumeration
Collapse the table of content
Expand the table of content

ViewStateEncryptionMode Enumeration


Specifies whether view-state information is encrypted.

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

public enum ViewStateEncryptionMode

Member nameDescription

The view-state information is always encrypted.


The view-state information is encrypted if a control requests encryption by calling the RegisterRequiresViewStateEncryption method. This is the default.


The view-state information is never encrypted, even if a control requests it.

The ViewStateEncryptionMode enumeration provides values for specifying whether the view-state information in a Page object is encrypted. The ViewStateEncryptionMode value can be set only in the @ Page directive or in the section of the configuration file.

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

.NET Framework
Available since 2.0
Return to top
© 2015 Microsoft