How to set Cache-Control response header in Sitecore?

By default, it seems that Sitecore is not caching pages. In web.config install this

<setting name="DisableBrowserCaching" value="false"/>

and create a pipeline processor

page.Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
page.Response.Cache.SetCacheability(HttpCacheability.Public); 

but it didn’t work, the head of the answer remains no-cache. By the way, I'm adding a pipeline to renderLayout, does anyone know? thank!

+3
source share
2 answers

I tried to reproduce this by setting the parameter to a DisableBrowserCachingvalue true. This will really trigger the header without a cache.

Then I installed it in falseand reloaded the page, and the no-cache header disappeared. Nothing more is needed.

If you want to set expiration headers, you must do this in IIS in the HTTP response header function.

+3

Sitecore 7 , HTML. , . , no-cache .

, Sitecore . . , (http://briancaos.wordpress.com/2012/04/12/identifying-mobile-devices-in-sitecore/), Sitecore DMS - .

, , .

+1

All Articles