Επεξεργασία

Κοινή χρήση μέσω


Page.ViewStateEncryptionMode Property

Definition

Gets or sets the encryption mode of the view state.

public:
 property System::Web::UI::ViewStateEncryptionMode ViewStateEncryptionMode { System::Web::UI::ViewStateEncryptionMode get(); void set(System::Web::UI::ViewStateEncryptionMode value); };
[System.ComponentModel.Browsable(false)]
public System.Web.UI.ViewStateEncryptionMode ViewStateEncryptionMode { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.ViewStateEncryptionMode : System.Web.UI.ViewStateEncryptionMode with get, set
Public Property ViewStateEncryptionMode As ViewStateEncryptionMode

Property Value

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

Attributes

Exceptions

The value set is not a member of the ViewStateEncryptionMode enumeration.

The ViewStateEncryptionMode property can be set only in or before the page PreRender phase in the page life cycle.

Remarks

The ViewStateEncryptionMode property cannot be set in code. It can only be set in the @ Page directive or in the < 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.

Applies to

See also