1

One of my QA Team just discovered the following: If you hit ESC twice when on a page containing an update panel with a control inside, if you click on anything else that does a postback, you'll get a System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using [...] error.

I would like to know more about the default behaviour of the ESC key. And might be interested in hooking up to the event to fire something else when that happens.

Message: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument. Event validation is enabled using 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.

Now Actually what is in my page My page just have following components

  1. .net4.0 or .net 3.5

  2. protected void btnSubmit_OnClick(object sender, EventArgs e){} I have nothing in code behind!!!

  3. you can repeat the error by a. remove the "" thing b. run your website in browser (IE8, compatibility mode also fails)

  4. follow the steps below carefully (you should have clicked the submit button twice and pressed Esc key four times after finishing this whole test case)

a. click on the textbox to set focus
b. press Esc key twice in your keyboard (i have tried two seconds per key press, you may try one hour per key press)
c. click on the submit button
d. click on the textbox to set focus back
e. press Esc key twice in your keyboard
f. click on the submit button

Any help will be surely appreciated.

Rahul Jain
  • 612
  • 1
  • 18
  • 49
  • There are similar issues reported: http://stackoverflow.com/questions/6123380/sys-webforms-pagerequestmanagerservererrorexception-error-on-ie8 – Dalorzo Jan 09 '14 at 14:48
  • This is a duplicate question : http://stackoverflow.com/q/20897321/1184435 – Devraj Gadhavi Jan 10 '14 at 16:49
  • @Dalorzo, yes it is. But, I see that OP has mentioned in his other post that he doesn't want to go with `EventValidation="false"`. So I don't think he has tried it yet, unless he confirms that he tried and it didn't worked. – Devraj Gadhavi Jan 12 '14 at 05:59

1 Answers1

1

If I recall correctly this behavior is related to a Cross-site scripting (XSS) validation.

There is an a way to confirm if it is because of XSS Validation, go to:

Tools -> Internet Options -> Security -> Custom Level -> Scroll To The Bottom of the List -> Click Disable XSS Filter

Or you can try with:

 <%@Page EnableEventValidation="false"... 

Both features are security features with the intention to avoid code injection.

There are other posts here describing similar steps referring to this same steps, just so you know:

JQuery-Ajax script not working in ie on second click but working in FF and Chrome on second click

Invalid postback or callback argument. Event validation is enabled using '<pages enableEventValidation="true"/>'

You can try to something like this to work around this:

http://www.codeproject.com/Articles/18238/The-UpdateProgress-Control-of-ASP-NET-AJAX-Extensi

Update 1

  • Another thing you can try is: EnablePartialRendering="false" to asp:ScriptManager

Make sure your site is rendering with the proper compatibility by using "edge":

<meta http-equiv="X-UA-Compatible" content="edge" />

If nothing above works, please try controlling the exception handler like this:

http://encosia.com/how-to-improve-aspnet-ajax-error-handling/

Community
  • 1
  • 1
Dalorzo
  • 19,834
  • 7
  • 55
  • 102
  • Hii Dalorzo thanks for your reply... But what are the options other than disabling event validation... – Rahul Jain Jan 05 '14 at 17:35
  • Normally if you are using ajax a spinner or disabling the buttons is the most often used.. – Dalorzo Jan 05 '14 at 17:38
  • Dalorza thanks again for your reply... But I didnt understand what u were saying... Ur saying to disable buttons ?? I am only using Ajax Update Panel and textbox and buttons thats it... – Rahul Jain Jan 05 '14 at 18:12
  • Try this: http://stackoverflow.com/questions/11089200/using-jquery-ui-modal-dialog-to-submit-a-form – Dalorzo Jan 05 '14 at 20:55
  • i tried all the above possible solutions but its not working :( so any other thing available ? – Rahul Jain Jan 09 '14 at 08:07
  • @RickJackson I just updated the POST with additional options. It is odd EnableEventValidation did not work. – Dalorzo Jan 09 '14 at 15:06