validateRequest and requestValidationMode dont work with .net 2.0
Asked Answered
A

2

13

I am hosting WCF Service in IIS 7. They are running under .net version 2.0. Everything is working fine. But lately, i am getting error list "Potentially Dangerous request ...". I searched on the internet and found out have i have to set my web.config like this.

<system.web>
    <httpRuntime requestValidationMode="2.0" />
    <pages validateRequest="false" />
</system.web>

I updated my web.config but then I am not able to browse to the services. It is giving me this error.

Parser Error Message: Unrecognized attribute 'requestValidationMode'. Note that attribute names are case-sensitive.

Please help me to resolve this error. Thanks, Vivek

Avictor answered 18/4, 2012 at 18:10 Comment(0)
D
20

The requestValidationMode attribute was introduced in .NET 4.0.

Under .NET 2.0 you should only have to add <pages validateRequest="false" /> to your Web.config to avoid Potentially Dangerous request errors.

You can also turn request validation off for an individual page using <%@ Page ValidateRequest="false" %>.

Doerr answered 9/6, 2012 at 4:8 Comment(0)
P
2

If you find requestValidationMode="2.0" in your web.config, it is very likely that the developer has been targeting against framework 4.0 or higher and you should probably set the application pool to the corresponding version, rather than change the settings.

Pleading answered 20/1, 2017 at 11:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.