简体   繁体   中英

Turning off Request.Form validation on inherited button control

Is it possible to turn off the Request.Form validation on a per control basis? The problem is that IE 6 and IE 7 puts the content of the <button> tag into the name attribute, thus resulting in html code in the attribute which makes asp.net server shout out loud.

Notice, this only happens in IE 6 and 7 because of their erroneous interpretation of HTML 4.

How about you style your button with CSS instead of doing it inline with non-semantic markup? That will solve the problem and make for better separation of concerns between structure and presentation.

If you're talking about the HttpRequestValidationException thrown when form controls contain potential XSS exploits then take a look at my answer to a similar question . I provide the code for a class module to intercept a postback before the validation event occurs and modify the form data.

I suspect however that the problem is not a bug in IE but possibly some invalid HTML or Javascript causing you trouble.

您可以始终在按钮中将CausesValidation属性设置为False:

CausesValidation="false"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM