Page.ViewStateUserKey Page.ViewStateUserKey Page.ViewStateUserKey Page.ViewStateUserKey Property

定義

在與目前網頁相關的檢視狀態變數中,指派識別項給個別的使用者。Assigns an identifier to an individual user in the view-state variable associated with the current page.

public:
 property System::String ^ ViewStateUserKey { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(false)]
public string ViewStateUserKey { get; set; }
member this.ViewStateUserKey : string with get, set
Public Property ViewStateUserKey As String

屬性值

個別使用者的識別項。The identifier for the individual user.

例外狀況

在網頁處理期間太晚存取 ViewStateUserKey 屬性。The ViewStateUserKey property was accessed too late during page processing.

備註

設定ViewStateUserKey屬性可協助您避免在您的應用程式,避免惡意使用者攻擊。Setting the ViewStateUserKey property can help you prevent attacks on your application from malicious users. 它會讓您指派給個別使用者的檢視狀態變數的識別項,使其無法使用變數來產生攻擊。It does this by allowing you to assign an identifier to the view-state variable for individual users so that they cannot use the variable to generate an attack. 如需有關 Web 攻擊以及您可以如何協助防止它們的詳細資訊,請參閱採取善用 ASP.NET 內建功能來擊退 Web 攻擊For more information about Web attacks and about what you can do to help prevent them, see Take Advantage of ASP.NET Built-in Features to Fend Off Web Attacks.

您可以為任何字串值,設定此屬性,例如使用者的已驗證的名稱或SessionID值。You can set this property to any string value, such as the user's authenticated name or the SessionID value.

注意

您必須設定這個屬性期間Page_Init頁面處理階段。You must set this property during the Page_Init phase of page processing. 設定這個屬性期間Page_Load階段會擲回的例外狀況。Setting this property during the Page_Load phase throws an exception.

適用於

另請參閱