Invalid postback or callback argument

C

Chris

Hi I intermittantly get this error on a ASP.net 2.0 page - Invalid postback
or callback argument - I want to check my understanding of this error as it
is really badly documented. If any of you guys can verify and offer advice
that would be great.

This error occurs when EnableEventValidation is set to true for a page.
Basically it means that .net will check that any posted data matches the
controls that where originally rendered and in the case of dropdowns also
their values. This is to stop people doing things like using visability to
hide controls when for example a user shouldn't have access to a button.
This kind of thing is supposed to be easy to hack.

You can switch it off in the web.config and page directive. What I don't
understand is the ClientScript.RegisterForEventValidation method. How does
does this work? Do you turn off the EnableEventValidation and tell .net
which controls could be a security risk if tampered with and so have it use
validation. Also I see some examples of dropdowns where you say what values
can be passed, what about textboxes where you don't know what value it will
be.

Also in direct reference to my problem. It is a very straight forward page
which only throws an error one in a thousand times. I saw one post where a
developer could only replicate the error when simulating a very slow
connection and so thought it had something to do with users pressing buttons
before pages had fully rendered. This is the one I think applies to me. Does
anyone have experience of this? Regards, Chris.
 
T

Teemu Keiski

Hi,

RegisterForEventValidation is to tell which is the expected argument(s), so
that event validation knows when the posted data or the posting control is
or isn't valid.

TextBox validates only with its UniqueID, not the value. E.g it checks that
data is coming from textBox that generated it. It's not checking the data
itself actually. data is checked with other means like request validation.
(With DropDownList validation uses the first of the values)
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top