Page.ViewStateEncryptionMode Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應