"Invalid postback or callback argument" Problem

In case you get the following exception while trying to run an ASP.NET application, the solution is not as simple as setting the "enableEventValidation" configuration to "false" all the time.

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.

I had such a problem last week. One of my colleagues asked me to check a problem because he could not see it and everything used to work perfectly before. I must confess that I spent hours to find the problem. Even if I set the "enableEventValidation" value to "false", nothing worked and everything started to lose its ViewState data.

Finally, I’ve found that the problem was a forgotten "form" tag within a user control. So, if you have such a problem about losing ViewState unexpectedly and exceptions about Event Validation, double check your code not to have such <form> tags.

You may also like...

5 Responses

  1. HttpContext.Current.Items.Add(“test”, search)
    Response.Redirect(“test.aspx”, True)

    it work fine on page load event but when i do post back it lost a data of search values any help!

  2. Coskun SUNALI says:

    Hi,

    I think it is normal to lose the ViewState because you are redirecting the client to an another page. Would you consider using Session?

    Regards,
    Coskun

  3. The post back has been fixed as well. It was an error on my side. Thx!

  4. Farhad says:

    Thanks,

    It was very helpful.

    Farhad

  5. senthilkumar says:

    i have a updatepanel in my page working fine locally in IIS 5.1 but when i move the page to the remote server the updatepanel causing fullpostback what is the problem? In the remote server we have IIS 6. I built the page using VS2008 framework.

    any suggestion to fix the issue

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.