Invalid postback or callback argument

Discussion in 'ASP.NET 2.0' started by cquestsearc, May 7, 2008.

  1. I got the subject message, plus a page of additional messages and stack trace. Research in MSDN produced:

    (start of MSDN)

    I went into my web.config file and inserted the following as suggested by microsoft:
    <system.web>
    <pages enableEventValidation="true" />
    </system.web>
    Now the error has gone away

    (end of MSDN)

    Has anyone else dealt with this? Do you agree with the above "solution". I understand the idea of event validation, but don't know what to do. I programmatically validate each field before updating the database. A related topic: Has anyone used the method to provide a more gentle message than stack trace? I use try/catch extensively, including where I think I got the stack trace, but it was not effective.

    Bill Schmuck
     
  2. I believe event validation is set to true by default.This features protects your application against unauthorized postbacks or callbacks.
    Try using using a custom error page for the page viewers.In case of an error,you can call a function in the catch block to send you an email with the exact error message and then throw an exception which will trigger the custom error page.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. In the past I had to do that at times on a page by page method rather than in the web.config
    Reason being it was killing some of my sessions, for example Ajax logins.
    The user would log in but none of the controls would load.
    Removing that from the page allowed the controls to load, which was indeed odd.

    I don't have a solution, just chatting.
    Salute,
    Mark
     
  4. In response to Vikram's reply:

    I know of no reason why there was an error in what I was doing, or exactly where inmy code to place try/catch logic (which I use extensively in this
    application). Maybe I need to start with learning how to interpret Stack Trace. In my development of this application over the last two years in Visual Studio 2005 and 2008, I havenever received such a message. The area in which the error occured is one that is relatively simple and has been
    thoroughly tested. I doubt that the nature of the error has anything to do with the postback originating from other than the server control that
    originally rendered it.

    In other words,right now I just don't knowwhat to do. The application is not yet "live", but is supposed to be ready for training others. I have suspended training until this issue is resolved. Contrary to this posting's category, my application is in .NET 3.5. I have not had much luck in researching this topic, either in my own library or in 'help'.

    Any assistance will be greatlly appreciated.

    Bill Schmuck
     
  5. This will summarize what I understand and don't understand about the "Invalid postback or callback argument" that I received on a new application:

    1. A postback or callbackwas being attempted by a different server than the originating server.

    2. I know of no way to control this in my application.

    3. I don't know how to determine "the origin and location of the exception" from the stack trace, so am unable to trap the exception with try/catch.

    4. This exception relates to postback or callback. What happens if a different server responds to a different page when I am using Session? It seems
    as if different servers would not have access to what is cached in Session.

    Bill Schmuck
     
  6. Bruce

    Bruce DiscountASP.NET Staff

    When your application does a postback, the viewstate is sent and the server will decipher the viewstate to see if it matches a session. If it doesn't match, it will throw this error.


    I don't think this is a huge problem but that's just my view.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page