Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a project that uses ASP.NET MVC 5 and angular.js
Recently (though I'm not sure when) changes to my angular.js views are not being reflected in the browser.
When I look at the developer tools in Chrome, it indicates that it is pulling it directly from cache. The Last-Modified header appears to be a couple days old and the ASP.NET server is returning 304 Not Modified for the html file.

Does anyone have any clue why my static content (specifically html files) are being cached by the browser when there *are* in fact changes.

What I have tried:

I have modified the Web.config like so:
XML
<system.webServer>
    ...
    <caching enabled="false" />
    <staticContent>
      <clientCache cacheControlMode="DisableCache"/>
    </staticContent>
</system.webServer>

However, that doesn't seem to make any difference.
I have also checked that the file system is recognizing my changes; the "date modified" on the files are much more recent than the "last-modified" being returned by the server.
Posted
Updated 22-Apr-16 4:53am
v2
Comments
Richard Deeming 20-Apr-16 12:56pm    
403 means "forbidden"; I suspect you meant 304. :)

Are you sure you're looking at the same folder that IIS is serving the files from?
Sean McIlvenna 20-Apr-16 14:06pm    
Whoops! I meant 304. Sorry.
Yes, I'm sure I'm looking at the same directory.

1 solution

Take a look at the following guide.

You can control caching by using headers.

Here's what a set of typical response headers look like when the caching is disabled.

HTTP/1.1 200 OK
Server: Apache
X-Rack-Cache: miss
ETag: "e6811cdbcedf972c5e8105a89f637d39-gzip"
Status: 200
Content-Type: text/html; charset=utf-8
Expires: Mon, 29 Apr 2013 21:44:55 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Mon, 29 Apr 2013 21:44:55 GMT


This is from the following article which covers the subject in depth.

A Beginner's Guide to HTTP Cache Headers | Mobify[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900