Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ValidateRequest = False but in action it's still True and ignored that?

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>" %>

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
}

:') but RequestValidation isn't Disabled too!

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

<pages validateRequest="false" />

RequestValidation still isn't turned off!

Why? thank's in advance ;)

like image 505
Sadegh Avatar asked Apr 23 '10 13:04

Sadegh


1 Answers

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" />
like image 102
Branislav Abadjimarinov Avatar answered Oct 06 '22 09:10

Branislav Abadjimarinov