I am working on a webapplication where users can login into their accounts and change settings for their accounts. If they make changes there, let us color for their account it will be modified in the css file and the new css should be applied for their account. But it is not doing that one since css file has been cached. I am using on IIS 7, C#, ASP.Net, IE 9 browser. Can any help me on this issue.
Asked
Active
Viewed 607 times
0
-
See http://stackoverflow.com/questions/117589/iis-css-caching – dash Dec 06 '11 at 13:10
2 Answers
0
I'm guessing that the css file is generated by some server side script, because you didn't told what language you use, i'll example with PHP. Well what you need is to send headers of cache control to the browser, so it won't save any cache on the css file, if you use PHP this is the code that you need to use:
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>
Remember to call the header functions before you send any data to the browser. Hope that solved your problem.

Dolev
- 86
- 3
0
Have the server render the page with a version string embedded in the path. For example:
httpx://www.yourdomain.com/css/12345/customized.css
Whenever the user modifies a setting in the CSS file, update the version and have new pages the user requests reference the new version.

RickNZ
- 18,448
- 3
- 51
- 66