I have a problem with caching on a specific page. Default EPiServer caches pages for 3600 minutes. Pages are discriminated by the ID querystring.
However there is one spesific pagetype that I do not want EPiServer to cache since it reads some data from another source. There is no logon the site.
Any idea for how to disable caching on pages of a specific type? I've been thinging of adding some random noise to the querystring:
ThePage.aspx?id=345×tamp=<%#datetime.now%>
%#datetime.now%>
And then adding 'timestamp' to EPsCacheVaryByParams in web.config.
But that only works when I have full control over how the page is linked to. If the link is from a pagelist, or link via the editor this method does not work.
Try overriding the SetCachePolicy() method in your template. Check if the page should be cached and call base.SetCachePolicy(). If not, try this:
base.Response.Cache.SetExpires(DateTime.Now);
base.Response.Cache.SetCacheability(HttpCacheability.Private);
ThePage.aspx?id=345×tamp=<%#datetime.now%> %#datetime.now%>
And then adding 'timestamp' to EPsCacheVaryByParams in web.config. But that only works when I have full control over how the page is linked to. If the link is from a pagelist, or link via the editor this method does not work.