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 user enters non-encoded HTML content into a comment text box s/he got something like the following error message:
"A potentially dangerous Request.Form value was detected from the client".
This was because .NET detected something in the entered text which looked like an HTML statement. Then I got a linkRequest Validation, that is a feature put in place to protect your application cross site scripting attack and followed accordingly.
To disable request validation, I added the following to the existing "page" directive in that .aspx file.
ValidateRequest="false"
But I still got the same error. Later I found that, for .NET 4, we need to add requestValidationMode="2.0" to thehttpRuntime configuration section of the web.config file like the following:
<httpRuntime requestValidationMode="2.0"/>
But if there is no httpRuntime section in the web.config file, then this goes inside the <system.web> section.
If anyone wants to turn off request validation globally for a user, the following line in the web.config file within<system.web> section will help:
<pages validateRequest="false" />
Note: But always avoid the last example because there is a huge security issue. The request validation feature in ASP.NET provides a certain level of default protection against cross-site scripting (XSS) attacks.
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 4.0 potentially dangerous Request.Form value was detected的更多相关文章
- 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 ...
- 解决.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
提交表单中包含特殊字符如<script>可能被认为是跨站攻击代码:解决方法很多,如stackoverflow上的web.config中加设置的方法不中肯[如原贴中Jamie M所说],主要 ...
- A potentially dangerous Request.Form value was detected from the client的解决办法
网上找了这么多,这条最靠谱,记录下来,以备后用 <httpRuntime requestValidationMode="2.0"/> <pages validat ...
- [BILL WEI] A potentially dangerous Request.Path value was detected from the client 异常处理办法
我们在ASP.net中使用URL导向后, 我们在访问某个地址,或者打开某个系统页面的时候,就会报错误: A potentially dangerous Request.Path value was d ...
- A potentially dangerous Request.Path value was detected from the client异常解决方案
场景: 当URL中存在“<,>,*,%,&,:,/”特殊字符时,页面会抛出A potentially dangerous Request.Path value was detect ...
- ASP.NET 4.0验证请求 System.Web.HttpRequestValidationException: A potentially dangerous Request.F
System.Web.HttpRequestValidationException: A potentially dangerous Request.F 在使用类似eWebedtior 拷贝内容进去的 ...
- System.Web.HttpRequestValidationException: A potentially dangerous Request.F
ASP.NET .0验证请求 System.Web.HttpRequestValidationException: A potentially dangerous Request.F System.W ...
随机推荐
- Duang的成长——使用造字程序输入生僻字
使用造字程序输入生僻字 最近,一个字突然间火了起来,那就是——duang! (图片来自网络) 那么,问题来了!造字程序哪家强?(此处有掌声) 其实,微软早就考虑到各国文字的博大精深,在系统中集成了一个 ...
- 完全背包问题:湫湫系列故事――减肥记I(HDU 4508)
湫湫系列故事――减肥记I HDU 4508 一道裸的完全背包 #include<iostream> #include<algorithm> #include<stdio ...
- Docker Hub仓库注册,使用
首先保证可以访问Docker Hub,所以需要先把host替换一下 : Google hosts ; 然后就是注册Docker Hub账户:https://hub.docker.com/; 然后就是在 ...
- 教务管理系统数据库E/R图
- 【Leetcode】【Hard】Merge Intervals
Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,1 ...
- C#像运行一个exe 程序一样运行一个dll文件
[DllImport("kernel32.dll")] public static extern int WinExec(string exeName, int operType) ...
- 使用七牛云存储实现Android的自动更新
为了修复Bug或更新软件,我们通常需要实现自动更新,没有哪一个牛逼的人能够搞到每一个用户的机子去帮他们更新. 1.自动更新的流程 我们将了解一下自动更新的思路.既然软件要自动更新,那么它必须知道自己是 ...
- Shell 判断
1 shell 的$! ,$?, $$,$@ $n $1 the first parameter,$2 the second... $# The number of co ...
- [J2ME] 基本框架框架
import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import jav ...
- 浅谈压缩感知(二十五):压缩感知重构算法之分段正交匹配追踪(StOMP)
主要内容: StOMP的算法流程 StOMP的MATLAB实现 一维信号的实验与结果 门限参数Ts.测量数M与重构成功概率关系的实验与结果 一.StOMP的算法流程 分段正交匹配追踪(Stagewis ...