ClientScriptManager.ValidateEvent feature and how to work with it.

C

chris

This topic is to get some details about the Event Validation feature in
ASP.NET 2.0. I have researched this topic quite a bit via the web, and
understand, for the most part how this works and why this happens. I
do, however, have some questions that I wonder if there may be any
concrete answers for.

First the error message is: "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 am sure everyone familiar with 2.0 and utilizing any kind of DHTML or
AJAX has seen this.

1. We have complex pages that use quite a bit of AJAX and DHTML, but
we think that everything is properly registered and ready to roll. We
capture Exceptions in the Application_Error method in Global.asax and
email the details to the relevant parties. I was wondering if there is
a way to extract the ValidateEvent parameters, uniqueid and argument,
strings that are triggering the exception. I expect the answer is no,
there is not a way, but maybe in a future release of .Net, this could
be added to the Data collection passed in the Base Exception class or
something. Anyone with any insight please feel free to comment.

2. We are pretty sure that the main reason our web application is
generating this error is because the form has not completely rendered
and the user clicks another button or link on the page causing a
postback. Is there any way to prevent this from happening?

Overall I think this is a fine feature. We use a bunch of client side
script so we enjoy the added security. I just wish it was a little
clearer what the culprit was when this Exception is thrown.

TIA,
Chris
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top