Asp.net mvc validaterequest无效的问题
在普通的asp.net下,可以通过在页面上注明 validateRequest=“false" 这个选项来关闭请求对注入攻击的验证,但在mvc下则不行。而且,在asp.net 4.0下,哪怕是在 action 上注明 [validateInput(false)] 也无法让验证关闭。对此微软的解释是:
ASP.NET Request Validation
The
request validation feature in ASP.NET provides a certain level of
default protection against cross-site scripting (XSS) attacks. In
previous versions of ASP.NET, request validation was enabled by default.
However, it applied only to ASP.NET pages (.aspx files and their class
files) and only when those pages were executing.
In ASP.NET 4, by default, request validation is enabled for all requests, because it is enabled before the BeginRequest
phase of an HTTP request. As a result, request validation applies to
requests for all ASP.NET resources, not just .aspx page requests. This
includes requests such as Web service calls and custom HTTP handlers.
Request validation is also active when custom HTTP modules are reading
the contents of an HTTP request.
As a result, request validation
errors might now occur for requests that previously did not trigger
errors. To revert to the behavior of the ASP.NET 2.0 request validation
feature, add the following setting in the Web.config file:
<httpRuntime requestValidationMode="2.0" />
However,
we recommend that you analyze any request validation errors to
determine whether existing handlers, modules, or other custom code
accesses potentially unsafe HTTP inputs that could be XSS attack
vectors.
Asp.net mvc validaterequest无效的问题的更多相关文章
- ASP.NET MVC Application_Error 无效不执行
我们一般在开发 ASP.NET MVC 应用程序的时候,会在 Application_Error 中添加异常日志记录,一般会记录 500 的错误信息,但如果应用程序在出错的时候,Application ...
- 【记录】ASP.NET MVC 4/5 Authentication 身份验证无效
在 ASP.NET MVC 4/5 应用程序发布的时候,遇到一个问题,在本应用程序中进行身份验证是可以,但不能和其他"二级域名"共享,在其他应用程序身份验证,不能和本应用程序共享, ...
- 关于linux asp.net MVC网站中 httpHandlers配置无效的处理方法
近期有Jexus用户反映,在Linux ASP.NET MVC网站的Web.config中添加 httpHandlers 配置用于处理自定义类型,但是在运行中并没有产生预期的效果,服务器返回了404( ...
- Asp.net mvc 自定义全局的错误事件HandleErrorAttribute无效
Asp.net mvc 自定义全局的错误事件HandleErrorAttribute,结果无效, 原因: 1.没有在RegisterGlobalFilters 里面添加或者你要的位置添加. 2.你把这 ...
- 解决ASP.NET MVC AllowAnonymous属性无效导致无法匿名访问控制器的问题
在ASP.NET MVC项目中,一般都要使用身份验证和权限控制,但总有部分网页是可以匿名访问的.使用AllowAnonymous属性就可以指定需要匿名访问的控制器,从而跳过身份验证. 但是今天却遇到一 ...
- Asp.Net MVC 页面代码压缩筛选器-自定义删除无效内容
Asp.Net MVC 页面代码压缩筛选器 首先定义以下筛选器,用于代码压缩. /*页面压缩 筛选器*/ public class WhiteSpaceFilter : Stream { privat ...
- asp.net mvc 中[Authorize]在IE9以上版本关于FormsAuthentication.SetAuthCookie无效的问题 解决方案
简单的解决方法是,在网站根目录,新增一个浏览器定义文件(browser definition file) 叫“App_Browsers”文件夹,然后里面放一个“IE10.browser”文件即可,网站 ...
- ASP.NET MVC中MaxLength特性设置无效
在ASP.NET MVC项目中,给某个Model打上了MaxLength特性如下: public class SomeClass { [MaxLength(16, ErrorMessage = &qu ...
- 成员资格、授权 – ASP.NET MVC 4 系列
ASP.NET MVC 不像 ASP.NET WEB FORMS 那样提供了很多自动保护机制来保护页面不受恶意用户的攻击,更明确的说,后者是致力于使应用程序免受攻击: 服务器组件对显示的 ...
随机推荐
- ffmpeg新老接口对比
http://blog.csdn.net/leixiaohua1020/article/details/41013567
- ROS机器人操作系统官方教程、源码汇总
1 wiki: http://wiki.ros.org/ 2 code: https://github.com/ ---- 1 基础教程 https://github.com/ros/ros_tut ...
- 自己总结 C++ 代码规范
.编写原则,代码尽量简单,简洁,高效,自己写的代码让自己和别人容易看懂 .命名: a. 类的成员变量加前缀 m_(表示 member). 常量全用大写的字母,用下划线分割单词(;) 循环变量和简单变量 ...
- 【集成学习】sklearn中xgboost模块中plot_importance函数(绘图--特征重要性)
直接上代码,简单 # -*- coding: utf-8 -*- """ ################################################ ...
- typecho去index.php
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} ! ...
- HDU1003 Max Sum
解题思路:最大连续和,此题多了记录的下标,具体见代码. #include<cstdio> #include<algorithm> using namespace std; #d ...
- LeetCode Permutation in String
原题链接在这里:https://leetcode.com/problems/permutation-in-string/description/ 题目: Given two strings s1 an ...
- lapis docker 运行说明
1. lapis docker 镜像制作 因为openresty 新版本一个json 库的问题,我们使用的是 openresty:1.11.2.1 基础镜像 FROM openresty/openre ...
- element popover 不显示/不隐藏问题解决方法
html代码部分 <el-table-column label="操作"> <template slot-scope="scope"> ...
- 基于C#的UDP协议的同步实现
一.摘要 总结基于C#的UDP协议的同步通信. 二.实验平台 Visual Studio 2010 三.实验原理 UDP传输协议同TCP传输协议的区别可查阅相关文档,此处不再赘述. 四.实例 4.1 ...