How can I refresh CSS caching?


Tags: css,asp.net,browser-cache

Problem :

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.



Solution :

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


    CSS Howto..

    How to wrap text to fill a DIV (like in MS-Excel) [duplicate]

    How to control the text inside DIV tag by not allowing the text to be increased?

    Wordpress how to tell my css version

    CSS and JQuery: how to remove “right:0” style

    How can I make a different CSS for the first child
    ?

    How to add class to column of grid with angular-ui-grid?

    CSS how to have two divs to the right of one div but not beside each other

    How to align radio buttons inside a DIV?

    How do CSS radio tabs work?

    How can I set a css property to tags with specific attribute?

    How do I move the background image of a DIV based on the scrollbar movement?

    how would I have the image in this div with rollover not get the overlay?

    How to stop default CSS in asp.net [closed]

    CSS: How to make background of an element stretch across the entire page?

    CSS: How to get two DIVs side by side with automatic height, to the height of their container?

    How to access parent element in CSS? [duplicate]

    Border display issue, not sure how to resolve

    How to preserve sibling element position when one sibling is absolutely positioned?

    How do I style a circular vertically-loading progress bar?

    css breadcrumbs breaks into 2 lines, how to controll it in responsive?

    How do I make the cursor stay as a pointer on text using jquery/javascript?

    How does one customize the appearance of jquery.perfect-scrollbar?

    How to override GWT obfuscated style for DataGrid header

    How to change MenuItem focus/hover color

    How do I alter this HTML/CSS to make the container expand horizontally to the floated children?

    how to use box-sizing:border-box on a fluid element with no height assigned?

    How to manage css left property for fixed div

    How to create rounded edge panel in ExtJS 2.1

    Horizontal
      navigation - how to vertical align contents of

    How to appear two HTML input elements in single line (row)