Export (0) Print
Expand All
2 out of 8 rated this helpful - Rate this topic

Page.EnableViewStateMac Property

Gets or sets a value indicating whether ASP.NET should run a message authentication check (MAC) on the page's view state when the page is posted back from the client.

Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)
public:
property bool EnableViewStateMac {
	bool get ();
	void set (bool value);
}
/** @property */
public boolean get_EnableViewStateMac ()

/** @property */
public void set_EnableViewStateMac (boolean value)

public function get EnableViewStateMac () : boolean

public function set EnableViewStateMac (value : boolean)

Not applicable.

Property Value

true if the view state should be MAC checked and encoded; otherwise, false. The default is true.

Set the EnableViewStateMac property to true when a high degree of data integrity is required between postbacks, or where there is a high risk of tampering.

In most circumstances, do not set this property in code. Set the EnableViewStateMac attribute to true using the @ Page directive in the .aspx file. When the page is requested, the dynamically generated class sets the property.

A view state MAC is an encoded version of the hidden variable that a page's view state is persisted to when sent to the browser. When you set the EnableViewStateMac attribute to true, the encoded and encrypted view state is checked to verify that it has not been tampered with on the client.

Security noteSecurity Note

This attribute should never be set to false in a production Web site, even if the application or page does not use ViewState. The view-state MAC helps ensure the security of other ASP.NET functions in addition to view state.

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, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.