Iis – IE does not properly use it’s local cache for intranet sites and returns HTTP 200 instead of HTTP 304

cachegroup-policyiisinternet explorerwebsite

I am a developer facing a problem at work. When I create any kind of .Net web application (ASP.Net, ASP.Net MVC), deploy it on my local machine's IIS or as an intranet application on our intranet IIS server and run it in a browser I get an unexpected result in IE.

Normally when you first access a site the files are downloaded and stored in the browser's local cache. On subsequent visits the browser sends a request to the server with the files Etags or last modified date. The server can respond with HTTP 304 if the files haven't changed thus preventing a full transfer of the file.

On my work network this works as expected for all browsers except IE who always returns HTTP 200 and thus downloads the file again.

I can start a new project in Visual Studio and caching works fine for other browsers but not IE. If I create the same project at home (on my own computer), caching works fine for all browsers including IE.

This makes me believe that there is something interfering with the process. Possibly some IE configuration (which is controlled by a Group Policy which I do not have access or maybe an IIS configuration, which again I do not have access or something else entirely.

I have access to IE's temporary files and I can see that the files are present in this folder.

What could be causing this? I need some information before approaching the sysadmins.

Headers under Fiddler

Headers under Fiddler

Developer Tools Network tab

Developer Tools Network tab

EDIT:

Here is a new project that I created and hosted in Visual Studio's IIS Express:

IE First Load:
enter image description here

Firefox First Load:
enter image description here

IE Second Load:
enter image description here
As we can see all the requests are 200 and the total time is sensibly the same.

Firefox Second Load:
enter image description here
As we can see, all requests after the main one are 304 and the total time is less than half of the first load.

Best Answer

After working on the problem I have found out this was due to the Internet Explorer Developer Tools in IE 11.

I found it out by opening Fiddler and the Internet Explorer Developer Tools at the same time.

If I hit refresh while the Developer Tools were open on the Network tab, the Dev Tools and Fiddler would register all HTTP 200.

On the other hand if I hit refresh while the Dev Tool were closed and Fiddler was open, Fiddler would register HTTP 304.

So it's the Dev Tool that are forcing the browser not to use the cache. As suggested by Saravanan in the comments, this is a configuration in the Dev-Tools in IE 11:

Internet Explorer - Dev Tools - always refresh from server

This did not happen when I tried the same tests at home because I was using IE Edge at home and IE 11 at work. This option has been changed in Edge which caused the difference in results.