Export (0) Print
Expand All

Page.ViewStateUserKey Property

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

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

[Visual Basic]
Public Property ViewStateUserKey As String
[C#]
public string ViewStateUserKey {get; set;}
[C++]
public: __property String* get_ViewStateUserKey();
public: __property void set_ViewStateUserKey(String*);
[JScript]
public function get ViewStateUserKey() : String;
public function set ViewStateUserKey(String);

Property Value

The identifier for the individual user.

Exceptions

Exception Type Condition
HttpException The ViewStateUserKey property was accessed too late during page processing.

Remarks

Setting the ViewStateUserKey property can help you prevent one-click 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 a one-click attack. You can set this property to any string value, such as the user's session ID or to the user's authenticated name.

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

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

Page Class | Page Members | System.Web.UI Namespace

Show:
© 2014 Microsoft