Caching and CssVersion problem & another approach

Feb 27, 2009 at 10:44 PM
Hello
I'm using it for compress and combine my css files and it works nice.
But cssVersion parameter doesn't work as expected.
Actually I don't like this usage releated management task problem and I developed alternative approach.

I added current date parameter application storage when fire application start event and I used this parameter as follow.
<link type="text/css" 
href="theme/css.axd?f=<% =Application["AppStartDate"].ToString()%>&d=ui.core.css,ui.theme.css,ui.accordion.css,
ui.datepicker.css,ui.dialog.css,ui.resizable.css,ui.tabs.css,SortableDemo.css"  rel="stylesheet" />

In such a case client browser download it as required as changed the application start date.

Actually I prefer control css file change date but it's not easy for implementation like this.
Or any idea ?

Thanks.
Coordinator
Feb 27, 2009 at 11:12 PM

Hi Mehmeim,

To force the client browser to update it's local cache, you have no choice but to change the url (or not cache it at all),

So your solution is nice and will work just fine.

You don't want to search all the combined css over the html and append a "version" query according to each file change date every request.

The overhead will be larger then the benefit of using another solution as yours.


Miron

http://blog.mironabramson.com







mehmetim wrote:

From: mehmetim

Hello
I'm using it for compress and combine my css files and it works nice.
But cssVersion parameter doesn't work as expected.
Actually I don't like this usage releated management task problem and I developed alternative approach.

I added current date parameter application storage when fire application start event and I used this parameter as follow.
<link type="text/css" 
href="theme/css.axd?f=<% =Application["AppStartDate"].ToString()%>&d=ui.core.css,ui.theme.css,ui.accordion.css,
ui.datepicker.css,ui.dialog.css,ui.resizable.css,ui.tabs.css,SortableDemo.css"  rel="stylesheet" />

In such a case client browser download it as required as changed the application start date.

Actually I prefer control css file change date but it's not easy for implementation like this.
Or any idea ?

Thanks.
Apr 10, 2009 at 7:59 AM
Hi, I think looking for latest changed date on used files and use it is right solution,
otherwise after app restart, new version is cached, and for small apps with low traffic restarts (shutdown/ startup)
is normal.

Petr