System.Web.UI.Page.EnableEventValidation Property

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

Syntax

public virtual bool EnableEventValidation { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

When the Page.EnableEventValidation property is set to true, ASP.NET validates that a control event originated from the user interface that was rendered by that control. A control registers its events during rendering and then validates the events during postback or callback handling. For example, if a list control includes options numbered 1, 2, or 3 when the page is rendered, and if a postback request is received specifying option number 4, ASP.NET raises an exception. All event-driven controls in ASP.NET use this feature by default.

If you write client script that changes a control in the client at run time, you might have to use the ClientScriptManager.RegisterForEventValidation(string) method in order to avoid false event validation errors.

Note:

This feature reduces the risk of unauthorized or malicious postback requests and callbacks. It is strongly recommended that you do not disable event validation.

You set the Page.EnableEventValidation property by setting the enableEventValidation attribute of the @ Page directive or the enableEventValidation attribute of the pages element in the Web.config file. If you set this property in code, you must set it before the page is initialized.

Requirements

Namespace: System.Web.UI
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0