ASP.NET Error Message: Invalid postback or callback argument
- January 18, 2010 10:35 AM
- Microsoft Tools, Mystery Error Message, Javascript
- Comments (0)
If you're trying to create a post-back from Javascript in ASP.NET, you might have come across the following error:
Invalid postback or callback argument. Event validation is enabled using in configuration or 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.
This message is caused because ASP is attempting to validate that a given post-back that was initiated from Javascript is really supposed to be happening; basically, it is an attempt to try to prevent cross-site scripting from issuing post-backs. You can do as the message says and register the callback, you can edit your web.config file, or you can do what I do, and add the following line to your Page directive in your .aspx page like so: