3

I'm using an outputcache for all my Umbraco v4 pages but would like to avoid such cache for any Ajax call ...

I added this line in default.aspx:

<%@OutputCache CacheProfile="umbProfil" %>

Then, in web.config:

<caching>
  <outputCacheSettings>
    <outputCacheProfiles>
      <add name="umbProfil" duration="120" enabled="true" varyByHeader="???"
           varyByParam="umbPage" location="ServerAndClient" />
    </outputCacheProfiles>
  </outputCacheSettings>
</caching>

Problem is now that all is cached, including my Ajax calls, which should not actually be : They are mainly forms and there field entries are maintained with the initial values till the cache expire...

To let you know, these Ajax are 'partial views' ie Umbraco regular pages that render only some forms...

How should I set the varyByHeader parameter so I actually cache everything related to umbPage EXCEPTING Ajax GET/POST calls ?

user1288337
  • 135
  • 1
  • 2
  • 7
  • Or another pretty acceptable solution may be to not cache POST calls (Ajax or not) as they all are the dark side of my caching system... – user1288337 Jun 19 '12 at 23:31

1 Answers1

0

As I'm using an antiforgery hidden textfield on each form, I finally used this form parameter as vary param.

<add name="umbProfil" duration="120" enabled="true"
               varyByParam="umbPage;__RequestVerificationToken" location="ServerAndClient" />

It seems to be working well, My umbPage are cached and my form POST aren't (or at least are but one cache instance is made for each POST and for 120 seconds).

If you guys have a better idea (no cache at all for any POST), please advice.

user1288337
  • 135
  • 1
  • 2
  • 7