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 ;)
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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With