Since IIS7 the entire IIS configuration can be applied through the web.config file, more specifically the system.webServer section . In this case, you should check the caching section and create a custom profile (be sure to set the variableByQueryString attribute to true to do the job "? Version = xxx").
During the deployment process, it is necessary that the URL change, since the client will not check for a new version of the file while the cache is valid (and you say that you can assign days as the duration of the cache). One common pattern is to automatically generate a url based on the modification date if your original string is:
<script src='functions.js' />
You can change it to:
<script src='<%=GetFilenameWithModificationDate("functions.js")%>' />
The function should get the modification of the DateTime file and add it to the file, so if the file was last modified from 2010-01-01 at 10:12:34, it should generate something like this:
<script src='functions.js?version=20100101101234' />
Thus, whenever you modify a file, a new query line will be added and the cache will be updated.
Since you work in caching your static file files, I assume that performance is a consideration, so you should consider the penalty for checking the change date for each file, and you may want to use caching in an auxiliary function, control, or which mechanism you decide to use.
NTN
source share