Invalid postback - Timing Issue With Render

S

stephenedavis

I keep getting the error message "Invalid postback or callback
argument" on my asp.net 2.0 pages in Internet Explorer. These pages
are simple, and just to make sure there is nothing wrong with the HTML,
I created an empty page with just the following in it:

<asp:Button runat="server" ID="Submit1" Text="Submit"></asp:Button>

When I navigate to this page and wait for the progress bar to show it
is complete 100% and then quickly click on the button, I get the error
message. However, when I do the same, except wait about 10 to 15
seconds after the page has completed downloading before clicking, I do
not get the error message.

I have done a bit of research on this and all of the literature I have
read points to a timing issue with rendering the page. The page has
completed its download, but it is still rendering (even though it is
displayed on the screen), and therefore upon clicking the submit
button, the verification of the control's events cannot be successfully
completed at the server, resulting in the aforementioned error message.

From reading posts on here, it seems as though most people give up at
this point and set EnableEventValidation to false to prevent the error
from showing. While I love "work-arounds" as much as the next person,
I would REALLY APPRECIATE a more definitive response to this topic. Is
this really a bug in V2.0? A previously posted message said it is not
a "bug" but the way .NET is designed...that's questionable if this
really is the behavior that is going on. Is there some sort of setting
I could do besides turning off a security feature to prevent this error
message?

Thanks in advance!
Stephen
 
B

bruce barker \(sqlwork.com\)

this is a generic problem with web pages. you can naviate before all
contenet has been parsed. if its a form submit, then the server will not get
all the postback values its expecting, because they were never rendered., so
they are not included. also expected client script may not be processed.

the best approach is to use real anchors for links (no postback required).
then either:

1) disable the submit buttons, and enable on client form load. (maybe ms
will add an option for this.) the complexityof this is that to handle
javascript not enabled, you need render as enabled, followed by client
script that disables (and saves the initial state), then enable in onload.

2) hook into the onsubmit and onload events. in onload set a var that load
happened. in onsubmit cancel submit if load has not occurred.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top