Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Page.ViewStateEncryptionMode Property

Gets or sets the encryption mode of the view state.

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

'Declaration
Public Property ViewStateEncryptionMode As ViewStateEncryptionMode
'Usage
Dim instance As Page
Dim value As ViewStateEncryptionMode

value = instance.ViewStateEncryptionMode

instance.ViewStateEncryptionMode = value
/** @property */
public ViewStateEncryptionMode get_ViewStateEncryptionMode ()

/** @property */
public void set_ViewStateEncryptionMode (ViewStateEncryptionMode value)

public function get ViewStateEncryptionMode () : ViewStateEncryptionMode

public function set ViewStateEncryptionMode (value : ViewStateEncryptionMode)

Not applicable.

Property Value

One of the ViewStateEncryptionMode values. The default value is Auto.

Exception typeCondition

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:

<%@ Page Language="VB" ViewStateEncryptionMode="Always" %>

<%@ Page Language="C#" ViewStateEncryptionMode="Always" %>

The syntax for setting this property in the configuration file is as follows:

<system.web>
  <pages viewStateEncryptionMode="Always" />
</system.web>

<system.web>
  <pages viewStateEncryptionMode="Always" />
</system.web>

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 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft