I have a ASP.NET MVC website hosted in IIS.
Sometimes I push changes and user’s browser may still using the previous files, causing functionality problems.
It is because the browser is caching those files right?
What can I do to ensure the user browser loading the updated files??
Thanks!
The easiest thing to do is append a date or version number on the URL as a querystring. Something like:
or
The browser will request a new file because the URL is different. The server will ignore the querystring (unless you are doing something clever).
The etag/last-modified suggestions are good, but do not address the problem of “telling” the browser that there is a new version of the file.