开发者

Website needs force refresh after deploy

After deploying a new version of a website the browser loads everything from its cache from the old webpage until a force refresh is done. Images are old, cookies are old, and some AJAX parts are not working.

How should I proceed to serve the users with the latest version of the page after deploy?

The webpage is an ASP.Net webpage using II开发者_如何学编程S7+.


You can append a variable to the end of each of your resources that changes with each deploy. For example you can name your stylesheets:

styles.css?id=1

with the id changing each time.

This will force the browser to download the new version as it cannot find it in its cache.


For ASP.NET you can use the cache control and expires headers. You can also set up similar headers in IIS 7 for your images. If you have any other cookies you can expire them manually.

I have not tried it, but it looks like you can do an ever better job of bulk setting cache control in IIS 7. See this thread and this link. At that point you are only left with unsetting any custom cookies you have (which you won't be able to control with HTTP cache control settings).

I don't know of any method to "unset everything all at once" easily.


You could use http headers to control the cache of your clients.

I'll just leave this here for you. http://support.microsoft.com/kb/234067

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜