Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

validateRequest="false" not working, even with requestValidationMode="2.0"

Tags:

asp.net

azure

wif

I have an ASP.NET Web Site running in Visual Studio dev-fabric (azure project) and am using ACS and WIF. My authentication process isn't working because after I login I get this:

A potentially dangerous Request.Form value was detected from the client (wresult="<t:RequestSecurityTo..."). 

The documentation states that I need to add

<pages validateRequest="false" />

and

<httpRuntime requestValidationMode="2.0" />

And I did - but I'm still getting the error. I've also added validateRequest="false" at the page level. But nada - still getting the same error.

These steps seem to have fixed the issue for other posters - is it something to do with running in dev-fabric perhaps?

like image 842
ConfusedNoob Avatar asked Oct 14 '11 21:10

ConfusedNoob


People also ask

How do I set false ValidateRequest?

You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case.

What is the use of ValidateRequest in asp net?

As you know, ValidateRequest is a security feature which has been available since . NET Framework 2.0 in WebForms. This feature prevents users from entering html content in input fields to keep the application away from different kind of XSS injection attacks.


1 Answers

I hadn't realised, but I'd accidentally added these settings within a location tag created by WIF:

  <location path="FederationMetadata">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
      <!-- wrong! -->
    </system.web>
  </location>
  <system.web>
      <!-- right! -->
    <httpRuntime requestValidationMode="2.0" />
    <pages validateRequest="false" />
like image 58
ConfusedNoob Avatar answered Oct 23 '22 03:10

ConfusedNoob