Export (0) Print
Expand All

Page.ViewStateUserKey Property

Assigns an identifier to an individual user in the view-state variable associated with the current page.

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

public string ViewStateUserKey { get; set; }
/** @property */
public String get_ViewStateUserKey ()

/** @property */
public void set_ViewStateUserKey (String value)

public function get ViewStateUserKey () : String

public function set ViewStateUserKey (value : String)

Not applicable.

Property Value

The identifier for the individual user.

Exception typeCondition

HttpException

The ViewStateUserKey property was accessed too late during page processing.

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. You can set this property to any string value, such as the user's session ID or the user's authenticated name.

NoteNote:

You must set this property during the Page_Init phase of page processing. Setting this property during the Page_Load phase throws an exception.

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, 1.1

Community Additions

ADD
Show:
© 2014 Microsoft