szpic
szpic

Reputation: 4498

The enableOutputCache parameter is not allowed

I'm trying to block IE from caching my webpage. After reading some question here I found that there are two solutions:

adding

[OutputCache(Duration = 0)] 

to the each controller or add this to web.config

<caching>
    <outputCache enableOutputCache="false" />
</caching>

I decided to go the second way. After putting it to my config file:

<system.web>
  <compilation debug="true" targetFramework="4.5" />
  <httpRuntime targetFramework="4.5" />
  <authentication mode="Windows" />
  <authorization>
  <deny users="?" />
    </authorization>
    <customErrors mode="Off" />
    <caching>
       <outputCacheSettings enableOutputCache="false" />
    </caching>
</system.web>

the enableOutputCache paremeter is underlined with message: "The enableOutputCache parameter is not allowed" What is wrong with my code?

Upvotes: 0

Views: 381

Answers (1)

teo van kot
teo van kot

Reputation: 12491

I think it is syntax error.

This should be:

<system.web>
  <compilation debug="true" targetFramework="4.5" />
  <httpRuntime targetFramework="4.5" />
  <authentication mode="Windows" />
  <authorization>
  <deny users="?" />
  </authorization>
  <customErrors mode="Off" />
  <caching>
      <outputCache enableOutputCache="false" />
  </caching>
</system.web>

If you want to know how to use outputCacheSettings you can find the answer here.

Upvotes: 1

Related Questions