Invalid postback or callback argument.

Rate It (4)

Last post 09-10-2009 11:11 AM by spankster. 181 replies.

Sort Posts:

  • Invalid postback or callback argument.

    09-27-2005, 9:15 AM
    Locked
    • Member
      35 point Member
    • krathni
    • Member since 09-26-2002, 11:29 PM
    • CT, USA
    • Posts 7
    (using Aug CTP)

    I have a composite control which consists of  label, linkbutton & textbox control. Depending on the display mode (a property within the control) one of the control gets displayed. However when the linkbutton is clicked it seems to throw up this error. The control works fine in .NET 1.1.

    The control inherits from System.Web.UI.WebControls.WebControl, IPostBackDataHandler & INamingContainer & this is my IpostBackDataHandler implementation

     #region  IPostBackDataHandler Implementation

            void IPostBackDataHandler.RaisePostDataChangedEvent()
            {
                OnTextChanged(System.EventArgs.Empty);
            }

            bool IPostBackDataHandler.LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection)
            {
                bool retVal = false;

                if (!this.Text.Equals(postCollection[postDataKey]))
                {
                    this.Text = postCollection[postDataKey];
                    retVal = true;
                }

                return retVal;
            }

          #endregion IPostBackDataHandler Implementation



    ####  ERROR BEGIN ####

    Invalid postback or callback argument.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: Invalid postback or callback argument.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Stack Trace:


    [ArgumentException: Invalid postback or callback argument.]
       System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +2088580
       System.Web.UI.WebControls.TextBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +89
       System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11
       System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +718
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3817

     


    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50712.6; ASP.NET Version:2.0.50712.6
  • Re: Invalid postback or callback argument.

    09-30-2005, 11:18 AM
    Locked
    • Member
      145 point Member
    • gerrod
    • Member since 04-21-2005, 3:05 PM
    • New York
    • Posts 29

    I have some code generating the same exception - only my code used to work in Beta 2 (v2.0.50215), and now doesn't work in RC1 (v2.0.50712).

    Can someone from MS please comment on this exception? Is this part of the security changes from Whidbey Beta 2 to RTM, regarding bubbling of events?

  • Re: Invalid postback or callback argument.

    09-30-2005, 11:52 AM
    Locked
    • Member
      145 point Member
    • gerrod
    • Member since 04-21-2005, 3:05 PM
    • New York
    • Posts 29

    I found a work-around to my problem. Try adding this into the <system.web> section of your web.config file:

    <pages enableEventValidation="false" />

    Works for me.
    /gerrod

  • Re: Invalid postback or callback argument.

    09-30-2005, 1:06 PM
    Locked
    • Member
      35 point Member
    • krathni
    • Member since 09-26-2002, 11:29 PM
    • CT, USA
    • Posts 7
    Sorry I should have updated this thread when I found the work around.

    RC gave me a better error message which helped me in fixing this.

    ## Actual 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.




  • Re: Invalid postback or callback argument.

    09-30-2005, 6:03 PM
    Locked
    • Participant
      880 point Participant
    • JoeBerg
    • Member since 08-20-2004, 1:08 PM
    • Redmond
    • Posts 176
    You can also benefit from those features by leaving it enabled then register your control for event validation. Simply add the following call in the PreRender or Render page life cycle then your control should work without having to turn off eventValidation:

          Page.ClientScript.RegisterForEventValidation(this.UniqueID);

    Hope this helps,
    Joe

  • Re: Invalid postback or callback argument.

    10-24-2005, 6:22 PM
    Locked
    • Member
      5 point Member
    • morda31
    • Member since 10-24-2005, 10:17 PM
    • Posts 1
    This will not work on PreRender, the error is as such "RegisterForEventValidation can only be called during Render(); "... but there is not OnRender event available.  Any suggestions on how to keep the validation on and get around this problem?  Again, this problem only occurs in RC1.

    Thanks

    Sincerely,
    Oleg
  • Re: Invalid postback or callback argument.

    11-01-2005, 9:12 AM
    Locked
    • Contributor
      3,583 point Contributor
    • mreyeros
    • Member since 12-05-2002, 10:32 AM
    • Miami, FL USA
    • Posts 647
    Has anyone found a correct way to resolve this issue?
    --------------------------------------------------
    Sincerely,
    Michael Reyeros

    Please remember to click โ€œMark as Answerโ€ on the post that helps you, and to click โ€œUnmark as Answerโ€ if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    If my solution doesn't solve your problem, just feel free to mark it as not answer and reply.
  • Re: Invalid postback or callback argument.

    11-05-2005, 3:55 AM
    Locked
    • Member
      5 point Member
    • Aphelion
    • Member since 11-05-2005, 8:50 AM
    • Posts 5
    use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

    How to do this? As someone said before, it is not possible to do it in PreRender and there is no Render event.
  • Re: Invalid postback or callback argument.

    11-06-2005, 5:54 PM
    Locked
    • Member
      10 point Member
    • zhouyuheng
    • Member since 11-06-2005, 10:49 PM
    • Posts 2

     Aphelion wrote:
    use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

    How to do this? As someone said before, it is not possible to do it in PreRender and there is no Render event.

    there is Render event in base class. to use it : 
    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
                MyBase.Render(writer)
     End Sub

    but, the problem is I do not know how to use RegisterForEventValidation method. where is the example for this?

  • Re: Invalid postback or callback argument.

    11-14-2005, 1:53 PM
    Locked
    • Member
      16 point Member
    • Entity
    • Member since 11-01-2005, 11:13 AM
    • Vienna
    • Posts 7
    HI... I'having the same *** as you have...

    I also don't know what to do.. the mdsn isn't very helpful, too.

    But I wanted You, if you can do me a favour.

    If You find out how to solve the Problem, couldi you please send me an Email. Cause usually I'm not using english forums.
    I promise I'll post the solution if I find it, too.

    thank you very much!

    regards Tuldi@gmx.net

    Patrick

  • Re: Invalid postback or callback argument.

    11-16-2005, 12:03 PM
    Locked
    • Member
      32 point Member
    • Keith Walton
    • Member since 11-16-2005, 4:58 PM
    • Sacramento CA
    • Posts 7

    I have the same problem with a VS.NET 2003 application upgraded to 2005 (release version). I receive the error from a page used to upload a file. I have tried the following, but it did not help:

    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
        Page.ClientScript.RegisterForEventValidation(
    Me.EdiFile.UniqueID)
        Page.ClientScript.RegisterForEventValidation(
    Me.Upload.UniqueID)
        MyBase.Render(writer)
    End Sub

  • Re: Invalid postback or callback argument.

    11-17-2005, 3:49 PM
    Locked
    • Member
      10 point Member
    • zhouyuheng
    • Member since 11-06-2005, 10:49 PM
    • Posts 2
    I set EnableEventValidation="false", then my page works with my Webcontrol. but I do not think that is a good idea.

    <%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage_Admin.master" AutoEventWireup="true" CodeFile="CategoryManagement.aspx.cs" Inherits="Admin_CategoryManagement" Title="Untitled Page" EnableEventValidation="false"  %>
  • Re: Invalid postback or callback argument.

    11-25-2005, 10:15 AM
    Locked
    • Member
      51 point Member
    • Michail2
    • Member since 11-23-2005, 11:53 PM
    • Posts 15
    Page.ClientScript.RegisterForEventValidation(this.UniqueID); does not work because    _requestValueCollection is never initialized in Page class. so function EnsureEventValidationFieldLoaded never will load dictionary with UniqueIDs and in this way cannot find control which is authorized to make postback via RegisterForEventValidation.

    It is uselss to call Page.ClientScript.RegisterForEventValidation

    Regards
    Michail
  • Re: Invalid postback or callback argument.

    11-25-2005, 2:03 PM
    Locked
    • Member
      51 point Member
    • Michail2
    • Member since 11-23-2005, 11:53 PM
    • Posts 15
    Actually I wanted to say that call to  Page.ClientScript.RegisterForEventValidation(this.UniqueID); will not work because in Page class there is variable _requestValueCollection,  never initialized and in this way function EnsureEventValidationFieldLoaded will not work properly.
    Result of this is that a call to Page.ClientScript.RegisterForEventValidation(this.UniqueID)  is useless and cannot change picture. Only EnableEventValidation="false" can make things to work.

    Regards
    Michail
  • Re: Invalid postback or callback argument.

    12-04-2005, 11:54 PM
    Locked
    • Member
      160 point Member
    • Werdna
    • Member since 06-21-2002, 3:14 PM
    • Chicago, IL
    • Posts 33

    Has anyone found a good solution for this?
    I just upgraded my app from beta 2 to final and keep see this error in my error log quite a log. I can't reproduce this myself, but I see a lot of people get this error on my site.

    I don't want to disable validation, but that's the only solution I found that works.

Page 1 of 13 (182 items) 1 2 3 4 5 Next > ... Last ยป