Page.EnableEventValidation Property

Gets or sets a value indicating whether the page validates postback and callback events.

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

Public Overridable Property EnableEventValidation As Boolean
Dim instance As Page
Dim value As Boolean

value = instance.EnableEventValidation

instance.EnableEventValidation = value
/** @property */
public boolean get_EnableEventValidation ()

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

public function get EnableEventValidation () : boolean

public function set EnableEventValidation (value : boolean)

Not applicable.

Property Value

true if the page validates events; otherwise, false.The default is true.

Exception typeCondition


The EnableEventValidation property was set after the page was initialized.

The event validation mechanism reduces the risk of unauthorized postback requests and callbacks. When the EnableEventValidation property is set to true, ASP.NET allows only the specific events that can be raised on the control during a postback request or callback. In this model, a control registers its events during rendering and then validates the events during postback or callback handling. All event-driven controls in ASP.NET now use this feature by default.

It is strongly recommended that you do not disable event validation. Before disabling event validation, you should be sure that no postback could be constructed that would have an unintended effect on your application.

In most circumstances, set the EnableEventValidation property by setting the enabledEventValidation attribute of the @ Page directive or the enableEventValidation attribute of the pages element of the Web.config file. If you set the EnableEventValidation property in code, set it in the Page_Init phase of page processing.

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