从客户端中检测到有潜在危险的 Request.Form 值

从客户端中检测到有潜在危险的 Request.Form 值
由于在.net中,Request时出现有HTML或Javascript等字符串时,系统会认为是危险性值。立马报错上面的错误。
解决办法:
解决方案一:
在.aspx文件头中加入这句:
<%@ Page validateRequest="false"  %>
解决方案二:
修改web.config文件:
<configuration>
  <system.web>
    <pages validateRequest="false" />
  </system.web>
</configuration>
因为validateRequest默认值为true。只要设为false即可。
当然,这样只能是让界面好看一些,要想抵制注入,还得从过滤上做足功夫
然后,还是有不禁用validateRequest的方法的,如下
不禁用validateRequest=false。
  正确的做法是在你当前页面添加Page_Error()函数,来捕获所有页面处理过程中发生的而没有处理的异常。然后给用户一个合法的报错信息。如果当前页面没有Page_Error(),这个异常将会送到Global.asax的Application_Error()来处理,你也可以在那里写通用的异常报错处理函数。如果两个地方都没有写异常处理函数,才会显示这个默认的报错页面呢。
  举例而言,处理这个异常其实只需要很简短的一小段代码就够了。在页面的Code-behind页面中加入这么一段代码:  
以下是引用片段:
protected void Page_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException)
{
Response.Write("请您输入合法字符串。");
Server.ClearError(); // 如果不ClearError()这个异常会继续传到Application_Error()。
}
}

转载于:https://www.cnblogs.com/dudu837/archive/2009/10/27/1590558.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Version 2.5&lt;br&gt;Attention : This version is not compatible with releases before FCKeditor 2.5.1.&lt;br&gt;&lt;br&gt;New Features and Improvements:&lt;br&gt;&lt;br&gt;[#1548] Compatible with Safari 3.0+ and Opera 9.50+. &lt;br&gt;Added specific project files for Visual Studio .NET 2003 and Visual Studio 2005. It's easier now to open the source in your preferred environment. Builds will end up in the &quot;1.1&quot; (VS2003) and &quot;2.0&quot; (VS2005) folders inside bin/Debug and bin/Release. &lt;br&gt;[#79] The BasePath property now defaults to &quot;/fckeditor/&quot; (&quot;/FCKeditor/&quot; previously). &lt;br&gt;[#79] Introduced the FCKeditor.IsCompatibleBrowser static function, to check if the requesting browser is compatible with FCKeditor. &lt;br&gt;[#79] Introduced the FCKeditor.CreateHtml function, which returns the HTML needed to create an editor instance in the page. &lt;br&gt;[#294] The HtmlEncodeOutput setting is enforced by the editor component, to avoid having to set ValidateRequest=&quot;false&quot; on pages using the editor. &lt;br&gt;Several changes to the File Browser and Uploader:&lt;br&gt;Several security checks have been introduced. Upgrading is hightly recommended. &lt;br&gt;The code has been reviewed according to our standards, aligning the FCKeditor.Net File Browser to the same quality and feature level present in other server language implementations of it, like the PHP implementation. &lt;br&gt;The connector can now be fully configured by using the &quot;editor/filemanager/connectors/aspx/config.ascx&quot; file, available with FCKeditor 2.5.1. &lt;br&gt;For file uploads, the file extension is precisely controlled in a list defined in the config.ascx file. &lt;br&gt;It is possible to define different folder locations for each file type. &lt;br&gt;Attention : For security, the connector must be explicitly activated, by setting &quot;Enabled = true&quot; in the config.ascx file. &lt;br&gt;Attention : The default connector path has been changed to &quot;/userfiles/&quot;, instead of &quot;/UserFiles/&quot;. This change should not impact Windows installations. &lt;br&gt;

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值