A potentially dangerous Request.Path value was detected from the client异常解决方案
场景:
当URL中存在“<,>,*,%,&,:,/”特殊字符时,页面会抛出A potentially dangerous Request.Path value was detected from the client异常。
原因:
是ASP.NET默认的拦截机制,保证页面URL传输的一定安全性。
解决方案有两种:
第一种,直接去除页面请求危险字符验证:
在web.config配置文件的<system.web>节点下添加代码如下:
<system.web>
<httpRuntime requestValidationMode="2.0"/>
<pages validateRequest="false" clientIDMode="AutoID"/>
</system.web>
第二种,设置哪些危险字符需要被验证:
<system.web>
<httpRuntime requestPathInvalidCharacters="<,>,*,%,:,&,/" />
</system.web>
注意其中的requestPathInvalidCharacters是一个以逗号分隔的无效字符列表。默认不存在此键值对时,意味着受限制的无效字符集(以,分割)是这7个:<,>,*,%,&,:,/
如果你想这些字符全部不受限制,就应该设置requestPathInvalidCharacters="";
如果你想部分字符受限制,就需要在requestPathInvalidCharacters中设置需要受限制的字符;例如:requestPathInvalidCharacters="<,>"。
A potentially dangerous Request.Path value was detected from the client异常解决方案的更多相关文章
- [BILL WEI] A potentially dangerous Request.Path value was detected from the client 异常处理办法
我们在ASP.net中使用URL导向后, 我们在访问某个地址,或者打开某个系统页面的时候,就会报错误: A potentially dangerous Request.Path value was d ...
- 解决.Net 4.0 A potentially dangerous Request.Form value was detected from the client 异常
在web.config中加入 <httpRuntime maxRequestLength="22000" executionTimeout="43200" ...
- A potentially dangerous Request.Form value was detected from the client问题处理
问题剖析: 用户在页面上提交表单到服务器时,服务器会检测到一些潜在的输入风险,例如使用富文本编辑器控件(RichTextBox.FreeTextBox.CuteEditor等)编辑的内容中包含有HTM ...
- 自己留存:小经验在asp.net 4.5或者asp.net mvc 5解决A potentially dangerous Request.Form value was detected from the client
以前的解决办法是 <configuration> <system.web> <pages validateRequest="false&q ...
- A potentially dangerous Request.Form value was detected from the client
提交表单中包含特殊字符如<script>可能被认为是跨站攻击代码:解决方法很多,如stackoverflow上的web.config中加设置的方法不中肯[如原贴中Jamie M所说],主要 ...
- A potentially dangerous Request.Form value was detected from the client的解决办法
网上找了这么多,这条最靠谱,记录下来,以备后用 <httpRuntime requestValidationMode="2.0"/> <pages validat ...
- ASP.NET 4.0 potentially dangerous Request.Form value was detected
A few days ago, while working on an ASP.NET 4.0 Web project, I got an issue. The issue was, when use ...
- System.Web.HttpRequestValidationException: A potentially dangerous Request.F
ASP.NET .0验证请求 System.Web.HttpRequestValidationException: A potentially dangerous Request.F System.W ...
- ASP.NET 4.0验证请求 System.Web.HttpRequestValidationException: A potentially dangerous Request.F
System.Web.HttpRequestValidationException: A potentially dangerous Request.F 在使用类似eWebedtior 拷贝内容进去的 ...
随机推荐
- Swift的函数与函数指针、闭包Closure等相关内容介绍
<span style="font-size:24px;">//函数 //demo1 无參数类型 func testConcat(){ println("測试 ...
- Web前端开发测试题阅读笔记
引自: http://www.w3cplus.com/css/front-end-web-development-quiz.html Q7:下面代码弹出值是什么? x = 1; function ba ...
- js 获取页面宽度
特例: 当$(window).width()无效时 /* 出现时机: iframe内嵌子页面在加载过程中取不到$(window).width(),非必现,机率大概1 / 20 */ 可用以下方式获取屏 ...
- Graph-DFS-图的深度优先遍历
#include <iostream> using namespace std; /* 5 5 1 2 1 3 1 5 2 4 3 5 1 2 4 3 5 ---------------- ...
- 微信小程序——template的使用方法
今天需要做一个[我的订单]页面,订单有几种状态,觉得把订单列表封装成一个模板更好.下面讲一下,如何用小程序自带的template构建一个模板. 1.构建订单列表模板页,命名为 [order.wxml] ...
- node学习笔记4——get数据传递
nodejs中,关于将接收到的数据处理为json格式用到的是 url 模块. 主要用到是下面3个东东: url.parse url.pathname url.query 我们看一个简单的例子: 先 ...
- R语言 使用命令行参数运行R程序
args_test.R 代码如下: Args <- commandArgs()cat("Args[1]=",Args[1],"\n")cat(" ...
- Rscripts的使用,以及如何为R脚本传参数
一.在windows下使用Rscript: 1.进入cmd.exe下,将当前工作目录转到Rscript.exe所在目录下面,然后调用Rscript **.R文件即可.但是所调用的.R文件必须是在R的 ...
- 基于CSS3飘带状3D菜单 菜单带小图标
这次我们要来分享一款很特别的CSS3菜单,菜单的外观是飘带状的,并且每一个菜单项有一个精美的小图标,鼠标滑过菜单项时,菜单项就会向上凸起,像是飘带飘动一样,形成非常酷的3D视觉效果.这款CSS3飘带状 ...
- JS函数重载解决方案
JS的函数定义可以指定形式参数名称,多多少少我们会以为js至少可以支持参数个数不同的方法重载,然而遗憾的是这仅仅是一个假象,js所有的参数都是以arguments传递过去的,这个参数类似于数组,在函数 ...