Question

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

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top