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

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)
[BrowsableAttribute(false)]
public virtual bool EnableEventValidation { get; set; }
<asp:Page EnableEventValidation="True|False" />

Property Value

Type: System.Boolean
true if the page validates postback and callback events; otherwise, false.The default is true.
ExceptionCondition
InvalidOperationException

The EnableEventValidation property was set after the page was initialized.

When the 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 RegisterForEventValidation method in order to avoid false event validation errors.

Security noteSecurity 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 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.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft. All rights reserved.