IE 8.0 Escape Key Issue Web Forms

为君一笑 提交于 2020-01-15 10:32:15

问题


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.


回答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/



来源:https://stackoverflow.com/questions/20936215/ie-8-0-escape-key-issue-web-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!