Page.ViewStateEncryptionMode Property
Gets or sets the encryption mode of the view state.
Assembly: System.Web (in System.Web.dll)
[BrowsableAttribute(false)] public ViewStateEncryptionMode ViewStateEncryptionMode { get; set; }
<asp:Page ViewStateEncryptionMode="ViewStateEncryptionMode" />
Property Value
Type: System.Web.UI.ViewStateEncryptionModeOne of the ViewStateEncryptionMode values. The default value is Auto.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The value set is not a member of the ViewStateEncryptionMode enumeration. |
| InvalidOperationException | The ViewStateEncryptionMode property can be set only in or before the page PreRenderphase in the page life cycle. |
The ViewStateEncryptionMode property cannot be set in code. It can only be set in the @ Page directive or in the <pages> element of the configuration file. Values set in the @ Page directive override any values set in the configuration file.
The syntax for setting this property in the @ Page directive is as follows:
The syntax for setting this property in the configuration file is as follows:
Custom control developers may wish to check the value of this property in code before saving potentially sensitive data to view state in their control.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.