0

I was trying to refresh the file x.css, which is served via a style bundle in mvc. I must add that the bundle optimizations were disabled for development purposes. I tried updating my web.config, restarting IIS and rebuilding the application. But none of this seemed to work. I also tried disabling caching as suggested in this answer:

ASP.NET MVC how to disable automatic caching option?

But the file would stay unaltered. The server finally refreshed the stylesheet after I reran the application multiple times followed by multiple (and I mean many) broswer refreshs. Why did this happen? Is there a better solution to this problem that does not involve renaming the file?

Community
  • 1
  • 1
  • Presumably you are using ctrl + f5 to refresh your browser? There is an option in chrome to disable all caching while the dev tools (f12) is open - click the cog to the right side on the dev tools window – Carl Oct 05 '14 at 16:02
  • Well, I was actually using Ctrl+R to refresh the browser. I can see from this answer that the effect is not quite the same: http://superuser.com/questions/205279/ctrlf5-vs-ctrlr-on-browsers But I'll try to disable the caching options next time. Thanks! – carbonelldx Oct 05 '14 at 16:13
  • 1
    Ah, use ctrl + f5 if you want to refresh page resources (in this case your css). Hope that solves your issue. – Carl Oct 05 '14 at 16:18
  • After a lot of testing, it looks like you were right in the first place @Carl . Thanks! – carbonelldx Oct 06 '14 at 16:30

1 Answers1

0

For bundling, the ?v querystring value will change when you update the file. So make sure your scripts have the ?v=... querystring at the end of them.

Control Freak
  • 12,965
  • 30
  • 94
  • 145
  • Is this value placed in the script/stylesheet path or the bundle virtual path? You mean to give it a random number or a Date as a query string parameter to the bundle url? or just the ?v. I tried appending a DateTime value to the bundle url and now is not loading the script at all. I also try appending just an empty ?v to the virtual path and the file path of the bundle with no results. – carbonelldx Oct 05 '14 at 17:16
  • If you look in your source code, The bundler does this automatically. It usually looks like this `style?v=12414532` instead of `style.css` – Control Freak Oct 05 '14 at 17:18