I am trying to disable cache for all Sitecore pages. I am able to do this through the code (through shared layouts) but I wanted to do it through just the config file. I came across many posts that mentioned setting DisableBrowserCaching = true in web.config would add no-cache, no-store to the response header. However, in my case it takes no effect.

I was wondering is there anything else I need to do along with setting DisableBrowserCaching = true?

Edit: Everything under caching section in content editor is unchecked.

  • 1
    Possibly answered here: sitecore.stackexchange.com/questions/2207/… – Mark Cassidy Jan 30 '17 at 21:23
  • Could you please verify that the configuration is not overriden by a patch to check /sitecore/admin/showconfig.aspx? – Tamás Tárnok Jan 30 '17 at 21:29
  • @MarkCassidy - Unfortunately not :( . – Akshay Mahajan Jan 30 '17 at 21:33
  • @TamásTárnok - Nope. It is not being overwritten. – Akshay Mahajan Jan 30 '17 at 21:35
  • Do you have cahcing.enabled set to true? If yes try making it to flase reset app pool and see what happens with other settings as it <!-- CACHING ENABLED Determines if caching should be enabled at all Specify 'true' to enable caching and 'false' to disable all caching --> <setting name="Caching.Enabled" value="true" /> – Mrunal Daftari Jan 31 '17 at 15:28

I assume you are building an MVC based site?

if so the renderLayout pipeline is not used, and this is where the Sitecore.Pipelines.RenderLayout.BrowserCaching function is called from, so since it isn't called, it will not have any effect

you could disable caching for all actions in a controller, or specific action as below:

[OutputCacheAttribute(VaryByParam = "*", Duration = 0, NoStore = true)] // will be applied to all actions in MyController, unless those actions override with their own decoration
public class MyController : Controller
  // ... 

Disable for a specific action:

public class MyController : Controller
    [OutputCacheAttribute(VaryByParam = "*", Duration = 0, NoStore = true)] // will disable caching for Index only
    public ActionResult Index()
       return View();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.