Export (0) Print
Expand All

PagesSection.EnableViewStateMac Property

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

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

public bool EnableViewStateMac { get; set; }
/** @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 ASP.NET should run a message authentication code (MAC) on the page's view state when the page is posted back from the client; otherwise, false. The default is false.

A view-state MAC is an encrypted version of the hidden variable that a page's view state is persisted to when sent to the browser. If true, the encrypted view state is checked to verify that it has not been tampered with on the client. Do not set EnableViewStateMac to true if performance is a key consideration.

The following code example shows how to use the EnableViewStateMac property.

// Get the current EnableViewStateMac property value.
Console.WriteLine(
    "Current EnableViewStateMac value: '{0}'",
    pagesSection.EnableViewStateMac);

// Set the EnableViewStateMac property to true.
pagesSection.EnableViewStateMac = true;

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

Community Additions

ADD
Show:
© 2014 Microsoft