We added a theme to our web forms project. There are two parts to this.
- We defined a theme (more information about this here) by adding a file to the project.
- MyProject
- app_themes
- MyTheme
- MyStyleSheet.css
- We applied the theme (more information about this here) by editing our web.config.
<pages theme="MyTheme" styleSheetTheme="MyStyleSheet">
Now all of our pages have the same style (which is great). However, we have another problem. When we update our style sheet, the changes are not reflected immediately in the browser. This is because most browsers implement caching by default. This is undesirable, so I started looking for solutions.
I found a solution: How to prevent CSS caching on a web page? By adding a query string to the end of the link, the browser thinks that it is a new file, and retrieves it. This won't work for us because we don't reference our style sheet like that. We don't have links to the style sheet on every page. We stuck our style sheet under app_themes, modified our web.config, and let ASP.NET apply it to every page for us.
We want to force the browser to get an updated css when we make a new build. What is the best way to accomplish that?