Saturday, May 31, 2008

Invalid postback or callback argument. Event validation is enabled - ASP.NET Problem & Solution

Problem
When developing a web site using ASP.NET 2.0, we encountered following error

---------------------------
Microsoft Internet Explorer
---------------------------
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.
---------------------------
OK
---------------------------


Solution


This problem was caused by extra <form> tags placed in the aspx file. A valid aspx file should have only one <form> tag. After identifying and removing the extra <form> tags, the problem is solved.


Hope this tip will be useful to you in case if you ever come across the problem.

0 Comments: