Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We are using visual studio to deploy images, css and js to a folder under layouts.

Editing these directly in the folder (which is more convenient for our designers than a full solution deploy) is posing problems as even with a ctrl+f5 in the browser, a cached version is loaded and the changes are not reflected.

The blob cache does not seem to be a factor as I've cleared it (via /_layouts/objectcachesettings.aspx). An app pool recycle or a full IIS reset does not work either.

How else is the css file cached and how does one clear it?

Thanks

share|improve this question
    
...but making the same change(s) within VS and redeploying does work? Would certainly support your theory that it's a server issue if that's the case. –  Rob D'Oria Aug 2 '11 at 12:58
    
its the case and would and do concur –  BobTodd Aug 2 '11 at 14:52
add comment

4 Answers 4

It's probably your browser, and there are differences between browsers.

One trick you can do is access the css files directly through the browser, which will cause an update. In your code, you can reference them the following way: myStyle.css?1234 to force an update every time.

share|improve this answer
    
tried all those tricks, its not the issue. ctrl+f5 always reloads it for me in chrome –  BobTodd Aug 2 '11 at 10:26
    
What about "Clear browser cache" in chrome? Does that help? –  tarjeieo Aug 2 '11 at 10:42
    
no. its not a client side issue –  BobTodd Aug 2 '11 at 11:06
add comment

Additionally you could disable browser cache to always retrieve the files from the server. You can do this in IE using the IE Developer Tools and in Firefox using Web Developer Toolbar.

share|improve this answer
    
no. its not a client side issue –  BobTodd Aug 2 '11 at 11:06
    
@BobTodd, why are you so sure? Try to use fiddler to check wether or not files are retrieved from the server! Apart from that, blob cache reset via the browser doesn't always work correctly. Try to manually empty your blob-cache folder. –  Bas Lijten Aug 2 '11 at 12:01
    
i've used fiddler; changed the querystring of the css file; ctrl +f5; cleared history. all the tricks. its a server issue 100% –  BobTodd Aug 2 '11 at 12:22
add comment

Have you tried adding a random querystring to each file reference in your markup? IIS has a nasty habit of caching text files and (even when a full refresh is requested) serving up the cached version on every request. It probably works when you redeploy from Visual Studio because the file is being deleted and rewritten, so IIS sees a new time stamp on the file and serves the new version. A common solution to force IIS to serve the file new each time is to pass a meaningless querystring, which makes think it needs to serve up a new copy of the file instead of a cached one.

For example, if your current links to your css and js files look like this:

<link rel="stylesheet" type="text/css" href="/_LAYOUTS/yoursolution/yourstyles.css" />
<script type="text/javascript" src="/_LAYOUTS/yoursolution/yourscript.js" ></script>

Generate a random number, or use a utc date time stamp and append it as a querystring like so:

<link rel="stylesheet" type="text/css" href="/_LAYOUTS/yoursolution/yourstyles.css?r=123654" />
<script type="text/javascript" src="/_LAYOUTS/yoursolution/yourscript.js?r=123654" ></script>

Just make sure that the number is different on each page load and it will force IIS to get a new copy of the file each time.

Microsoft actually uses this exact trick in SharePoint. If you view the source of any standard SharePoint page and look at the javascript and css links, you'll see a rev=[SomeRandomString] appended to each filename. That querystring is totally meaningless and just makes sure that you get the most up-to-date version of the files each time.

share|improve this answer
add comment

I had the same issue. Make shore that you are dropping files in correct folder. For old 2010 UI sharepoint 2013 are using hive 14 not 15.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.