Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > pragma no cache View modes: 
User avatar
Member
Member
tony.leatahm-eggheaddesign.co - 10/20/2009 2:47:01 AM
   
pragma no cache
Hi Everybody

I love Kentico - we're a gold partner and have built a lot of sites with it, both as a CMS and as a web application framework.

I also love the company - the best technical support in the business.

However, I recently noticed that by default, the portal engine emits a pragma no-cache directive into the HTML. I think this is a really BAD thing - it tells the browser not to cache assets. So, I exchanged several emails with Kentico support, who tell me that they have no intention of removing this statement.

I don't think they fully understand the performance hit that sites with this in place will suffer. I did some testing on a site recently using Firebug, and the difference in data transfer was something like 300KBytes between having the no-cache directive and not. Now, 300K represents quite some time to download even on a fast connection. And that's for EVERY page on the site.

What makes this harder to accept is that there is really no necessity for this statement to be included. The motivation that Kentico Support gave for this was so that the user always gets upto date content. However, this is a misunderstanding of how browsers work.

If an asset such as an image is cached, the browser carries out a conditional GET. In other words, there's a conversation between the browser and the server that goes like this:

Hey, do you have a new version of xxxx.jpg?
Nope
OK, I'll use the one I've got

If the GET is for a dynamic page (i.e. one with an ASPX extension), the server will always hand over to the asp.net worker process, meaning that the page is requested again. OK, if caching is set on SERVER side, the content will be delivered from ASP.NET cache.

There's a couple of points to note here. Firstly, if pragma no-cache is present, the content of the page may still be old because it might be delivered from the server's cache, meaning that the intention of including the no-cache directive is defeated. Also, things like the kentico GetCSS.aspx page for delivering the CSS file can never be cached browser side.

Without the no-cache directive, the browser will not need to download static files such as images, images used by CSS, CSS files, javascript files etc. each time a page is requested. It will use it's own copy. I'd estimate that the overwhelming majority of pages on the internet do not include the no-cache statement.

Now, I'd like to invite everybody's opinion here:

Should Kentico stop injecting the no-cache directive by default?

User avatar
Member
Member
jodie-wdm.com - 11/24/2011 4:47:30 PM
   
RE:pragma no cache
Hi,

I was just trying to find out how to remove it also, and by the looks you can't? I agree it is a bad thing, so is there any way to remove it??

Should Kentico stop injecting the no-cache directive by default?
YES.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/25/2011 2:25:40 AM
   
RE:pragma no cache
Hi,

You can remove this tag - you can change following code to the ~\CMSPages\PortalTemplate.aspx.cs file:

this.ltlTags.Text = this.HeaderTags;

to:

this.ltlTags.Text = this.HeaderTags.Replace("<meta http-equiv=\"pragma\" content=\"no-cache\" />", "" />");


Best regards,
Juraj Ondrus