ValidateRequest =假,但在行动中它仍然是真实的,并忽略了? [英] ValidateRequest = False but in action it's still True and ignored that?

查看:150
本文介绍了ValidateRequest =假,但在行动中它仍然是真实的,并忽略了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用的 RequestValidation在特定视图中 ASP.NET MVC 2.0 RTM 。所以我加了一些必要如下查看Page指令部分:

i want disable RequestValidation on particular view in ASP.NET MVC 2.0 RTM. so i added some necessary to view Page directive section as below:

<%@ Page ValidateRequest="false" Language="C#" MasterPageFile="Path" Inherits="System.Web.Mvc.ViewPage<Path>" %>

RequestValidation 未被禁用!我还添加了 RequestValidation属性相关行动控制如下:

but RequestValidation isn't Disabled! i also added RequestValidation Attribute to related action in controller as below:

[System.Web.Mvc.ValidateInput(false)]
public System.Web.Mvc.ActionResult Create(Model instance)
{
    //Do here something
}

:!'),但 RequestValidation 未被禁用过

在最后一次尝试我将 RequestValidation 以虚假的的Web.config 文件,如下:

in last try i set RequestValidation to false in Web.config file as below:

<pages validateRequest="false" />

RequestValidation 仍然没有关闭!

为什么呢?感谢的提前;)

推荐答案

如果您正在使用asp.net 4.0中的验证请求功能的行为已经从2.0版本的变化。查看重大更改文档这里。如果是这种情况下,你可以通过像这样在web.config中设置请求验证行为,回到2.0解决问题:

If you are using asp.net 4.0 the validate request feature behavior has been changed from version 2.0. Check out the breaking changes document here. If this is the case you can resolve the problems by setting the request validation behavior back to the 2.0 in the web.config like this:

<httpRuntime requestValidationMode="2.0" />

这篇关于ValidateRequest =假,但在行动中它仍然是真实的,并忽略了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆