Background
An MVC 4 application needs to include JavaScript that is generated from the database. The generated file is relatively large, and changes only occasionally (changes every 2-10 days).
The accepted answer of
Generate javascript file on the fly in asp.net mvc
provides a good framework for generating the JavaScript. However, the URL of the JavaScript resource is static. As I understand it, the browser will cache that resource. That caching can be controlled by the OutputCacheAttribute
.
Question
How can I cause the browser cache to expire whenever the generated JavaScript changes, similar to the way that bundles work? A SqlDependency
for the OutputCacheAttribute
is not an option.