1

I already attach query string to my url

 "~/App_Theme/cssstyle/default.css?v=1" 

but the style on the page was still not updated. In my IE's developer tool on css tab show both css file. How can I fixed this problem?

Thank you in advance.

1
  • Can you share your complete markup? I think you are referencing the same CSS from two different locations, maybe from master page... Commented May 29, 2014 at 5:07

2 Answers 2

3

Each time you make a change and want to force the browser to fetch the latest version, you need to update the number on the end of your path, so something like:

"~/App_Theme/cssstyle/default.css?v=2"

then

 "~/App_Theme/cssstyle/default.css?v=3"

etc. The number can be anything, it doesn't need to be sequential. It just tells the browser that a different version is required.

In your case, your changes are not visible because you are specifying a particular version of your file. If you remove the version number parameter from your path, then clear the cache, you should see your changes:

 "~/App_Theme/cssstyle/default.css" 

You can also press Ctrl+F5 to force the browser to do a 'hard refresh', which re-fetches all assets.

As a last resort (and a good habit to get into if you're developing) is clearing the cache regularly. In most browsers, you can do this with Ctrl+Shift+Del. You can also do this automatically in Chrome by selecting Disable cache (while dev tools are open), and leaving the dev tools open with F12

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

3 Comments

Thank you. I just forgot to change query string once again.
No problem, this one is burnt into my brain after thinking there was a server caching issue with my hosting provider for months! Definitely a lifesaver
Not sure if you are using Chrome, but in case you are, there's a setting that you can activate to disable cache when the Developers Tools Panel is open. This IMH is the easiest use case.
-2

In most browsers it is Ctrl+F5, (on windows)

2 Comments

Minus one because he was asking from a developer perspective not from a user perspective...
Fair enough, but the question was not really clear, (to me), if it was from a developer or user point of view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.