2007
12.05

EnableEventValidation Error

Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation=”true”/> in configuration or <%@ Page EnableEventValidation=”true” %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Event validation is a security measure by ASP.NET to prevent Injection-Attack (i.e. other page post their result to your ASPX page). Turning this option off through the web.config or inside the <%@ Page .. %> tag will guarantee you will never receive above error, but your security might be compromised.

But if your page still producing above error, say when you click a button, or select the value of a server dropdownlist control, these conditions might be applicable to your ASPX page:

  1. You have another <form /> tag inside your main Form tag
  2. Your AJAX/Javascript code changed the value of a server control
  3. You type tags that resemble HTML tags inside a textbox/text-area

What I have today was number 1. I found a <form /> tag inside a < asp:Content .. /> tag. The error came out when I convert my ASP.NET Website project into .NET Web Application Project. So its quite surprising that page never throw any Event validation error during its tenure as Website project. Another possibility is the <form /> was generated by Visual Studio when i convert the project. I’ll do some trial and error more tomorrow…

GD Star Rating
loading...

Incoming Search Term

Advertise Here

2 comments so far

Add Your Comment
  1. I have been slamming my head on my desk regarding this issue for 2 days. Thanks for making me see the light. My issue was an extra ” tag. I removed it and it worked like a charm!

  2. Thanks a million for sharing the list – especially number 1 😉
    We’ve been almost to the point of disabling eventvalidation at all…