I have a Facebook-style modern button control whose client side markup looks like:
<button id="ctl00_uxBtn" value="ctl00$uxBtn" name="ctl00$uxBtn type="submit"> <div style="background-image: url("Icons/page_edit.png"); background-position: left center; background-repeat: no-repeat; line-height: 16px; padding: 3px 0pt 3px 22px;">Save Draft</div> </button>
此按钮正常工作与IE和FF使用Visual Studio 2010的Web服务器,但是当我将应用程序部署到服务器(Windows Server 2008 / IIS 7.0)我收到检测到有潜在危险的Request.Form值错误,但只能用IE浏览器。看来,IE是传递ctl00_uxBtn =&LT; DIV的风格=背景图片:。...标记的Request.Form集合,其中IIS正确地跨$ P $点作为一个潜在的脚本注入漏洞最好的我可以说,FF通过ctl00_uxBtn =ctl00 $ uxBtn,这是完全可以接受的。有没有什么办法来强制IE成更FF-样的行为?我不想禁用请求验证。
This button works fine with both IE and FF using the Visual Studio 2010 web server, but when I deploy the application to the server (Windows Server 2008/IIS 7.0) I get "A potentially dangerous Request.Form value was detected" error, but only with IE. It appears that IE is passing the ctl00_uxBtn="<div style="background-image:..." markup in the Request.Form collection, which IIS correctly interprets as a potential script injection vulnerability. As best I can tell, FF passes ctl00_uxBtn="ctl00$uxBtn" which is perfectly acceptable. Is there any way to force IE into more FF-like behavior? I do not want to disable request validation.
IE坚持之间发送和其中的内容;按钮&GT;和&lt; /按钮&GT;作为按钮的值,并且有没有出现有一种方法来prevent它。因此,我们截取使用onsubmit事件处理程序,例如在客户端请求:
IE insists on sending the content between <button> and </button> as the value of the button, and there does not appear to be a way to prevent it. So, we intercept the request on the client side using an onsubmit event handler as such:
<form id="form1" runat="server" onsubmit="fixModernButton()">
我们的JavaScript函数,然后检查是否浏览器是IE,如果按钮的文字属性以&LT;。如果是这样,这是标记,将导致ASP.Net提高了潜在危险的Request.Form值的错误,所以我们innerHTML属性的值设置为innerText属性的值,然后提交表单。该人士对JavaScript函数是:
Our javascript function then checks if the browser is IE and if the button's innerHTML property starts with "<". If so, it is markup and will cause ASP.Net to raise the "Potentially dangerous Request.Form value" error, so we set the value of the innerHTML property to the value of the innerText property then submit the form. The source for the javascript function is:
function fixModernButton() { if (navigator.appName === 'Microsoft Internet Explorer') { if (document.activeElement.innerHTML && document.activeElement.innerHTML.charAt(0) === '<') { document.activeElement.innerHTML = document.activeElement.innerText; } } document.forms['form1'].submit(); }
相关推荐
工程信号处理(2023最新工程信号处理百科介绍)
读书(1979年创刊的杂志)
闲迈(词语)
宝矿商城(宝矿商城)
教育科研论坛(小学教育科研论坛)
分拣地图℃的列表,字符串,字符串&GT;字符串、地图、列表、GT
定义在Android的按钮事件的最佳实践按钮、定义、事件、Android
弯曲 - 滚动条到一个HorizontalList将组件的顶部改变位置弯曲
在Nexus S和三星Galaxy S I9000 ACTION_IMAGE_CAPTURE定位问
侧柏叶熬水洗头的注意事项是什么_用桑叶熬水洗头
肚子痛拉血是怎么回事_大便拉血是怎么回事
童装品牌哪个最好_上海哪个商场童装品牌最全
最快最有效的去痘印方法是什么_最快最有效去痘印方法有哪些
炖猪蹄火锅的做法_炖猪蹄火锅有哪些家常做法呢
椰根的功效与作用_猪脑的功效与作用有哪些?
怎么预防口腔癌?相关事项一定要牢记_口腔扁平苔藓症状,及时治疗预防
嗓子痰里有血怎么办_咽炎痰里有血怎样调理呢
过午不食的好处是什么?_过午不食的坏处
如何用ebookpk电子书制作器把pdf文件转为epub格式电子书(如何用桌
室外运动场地面材料常用的有哪几种(合成材料运动场地面层)
最新文章
2020年度最具影响力的25位企业领袖
世界宠物协会(世界宠物协会)
古丰村(古丰村)
CIO时代网(CIO时代网)
千佛山西路(千佛山西路)
卓尼乡(西藏自治区那曲市尼玛县辖乡)
ONS-导航仪导航仪多次在一个页面模板模板、页面、ONS
周围的圆的中心沿半径文本半径、文本、中心
.NET:强命名与Authenti codeNET、Authenti、code
致生活不易的自己说说 累了的句子说说心情_致生活不易的自己说说
献血需要什么要求_献血需要什么要求
什么是GPA 如何计算GPA_GPA是怎么算的
做到7点必可预防老年性耳聋_预防老年性耳聋吃什么好
女性更年期怎么补钙呢_更年期补钙食物有哪些 女性更年期食疗补钙
补气补血头晕应该如何调养呢_补气补血头晕如何调养
用芦荟洗脸有什么好处_蜂蜜牛奶洗脸有什么好处
草酸是什么_薰衣草酸奶油芝士蛋糕的做法
肛周脓肿一定会引起肛瘘吗_肛瘘的偏方
铅中毒的危害_无铅皮蛋的制作方法
急性乳腺炎的治疗_怎样进行哺乳期急性乳腺炎的治疗