ValidateRequest = 'false' not working in .Net 4.0 and 4.5 in ASP.Net

Last Reply on Mar 18, 2014 09:26 AM By Mudassar

Posted on Mar 18, 2014 09:23 AM

Hi,

I am setting valdiateRequest = false in Web.Config as well as on the @Page Directive.

But it does not work for .Net 4.5 and .Net 4.0 Frameworks but works if I downgrade to .Net 3.5

Please help

 

Posted on Mar 18, 2014 09:26 AM

To make the ValidateRequest work for .Net 4.0 or higher frameworks you will need to add the followings setting in the web.config <system.web> section

<httpRuntime requestValidationMode="2.0"/>

Once you add it then you can set validateRequest = false in web.config or in the @Page Directive. It will work!.

For more details refer ASP.Net Error: A potentially dangerous Request.Form value was detected from the client