检测到潜在危险的Request.Form值

时间:2011-03-07 06:42:41

标签: asp.net

我收到此错误

A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$txtEmbed="<embed src='http://a...").

当我在链接按钮上打开一个modalpopup扩展器点击并在后面的代码中我正在分配文本框

value="<embed src='http://auddia.com/player-viral.swf' height='20' width='200' allowscriptaccess='always' flashvars='volume=100&autostart=false&file=http://auddia.com/Audios/audioStream_1299222864888_19.flv&plugins=viral-1d'/>

我还在页面指令中设置了ValidateRequest="false"。在我后面的代码中我也使用HttpUtility.HtmlEncode。但我一次又一次地面对这个错误

"A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$txtEmbed="<embed src='http://a...").".

请尽快帮助我。

2 个答案:

答案 0 :(得分:3)

尝试将此添加到您的web.config。

<configuration>
  <system.web>
   <httpRuntime requestValidationMode="2.0" />
  </system.web>
</configuration>

答案 1 :(得分:0)

<system.web>
    <httpRuntime requestValidationMode="2.0" />
</system.web>