3

I have been building an ASP.NET MVC 5 project for a few days, and mainly playing around with the CSS file. However, all of a sudden, the CSS file which is being use to display the HTML in a browser has reverted to an old version.

In BundleConfig.cs, I have:

bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

And the ~/Content/site.css file has been incrementally updated over the last few days, with the changes being observed in the HTML when I run the program from Visual Studio.

But today, I noticed that the rendered HTML is suddently entirely different. When I View Source in Firefox, in the <head> tag it shows:

<link href="/Content/site.css" rel="stylesheet"/>

as would be expected. But if I click on the link to this CSS file from this source file, then it displays the contents from a very old CSS file from a few days ago. I have checked multiple times that the file at Content/site.css is indeed my new version, and not this old version. I have tried cleaning, rebuilding, restarting Visual Studio etc., but none of these make a difference.

This is very strange - any ideas on what I might to do try to figure out what's going on?

Thanks!

3
  • 2
    Are you working on this using any kind of version management system like SVN or GIT? If not, try clearing your browser cache and loading it up again. Commented Apr 30, 2014 at 14:42
  • Ah, restarting my browser a couple of times did the trick! Thanks - I had tried this before and it didn't work, but it just needed a few restarts. Simple! Thanks! Commented Apr 30, 2014 at 14:56
  • 2
    fYI Pressing Ctrl+r will refresh all the browser files from the server. Commented Apr 30, 2014 at 19:13

1 Answer 1

5

This problem, most of the times, is related to the browser cache, what you need to do is to force the browser to reload the page and load the cache again.

For Google Chrome:
Launch the Developer tools/inspector window by pressing Ctrl + Shift + I, and then right click on the refresh button, a context menu will appear, click on Empty cache and hard reload

For Firefox (Tested on Developer Edition) Click Ctrl + r or hold Ctrl and then press F5.

I had the same problem as yours, pressing Ctrl + r solved the problem for me, as I'm using Firefox Developer Edition.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.