1

I've set up a caching on a SharePoint site. But have one specific page that should never be cached.

How do I disable caching for a specific publishing page on a SharePoint site? Or how do I flush the page cache programmatically?

3

There are various ways:

// Stop Caching in IE
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
// Stop Caching in Firefox
Response.Cache.SetNoStore();

or you could use the @Output property:

http://msdn.microsoft.com/en-us/library/ms178606(VS.80).aspx http://msdn.microsoft.com/en-us/library/hdxfb6cy(v=vs.80).aspx

Here you can find all the instruction: http://support.microsoft.com/kb/323290

2

Create a WebPart which calls PublishingHttpModule.DontEnableCachingForRequest and insert that on the page.

1

Although the answer is already posted I want to say that in my case the problem was with Content Query Web Part caching. And to disable it I set UseCache attribute to False using SPD.

  • 1
    Thanks @Serhiy I'm experiencing the same issue in CQWP, and this is a big help! – YogaPanda Mar 1 '18 at 18:17
0

Please note that Web Parts do not inherit from the Page class. So, you may have to use: Page.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);

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.