Ok - so I am testing a web application and am getting some strange behaviour on my development box that I can't work out. The same behaviour is not exhibited on a colleagues machine.
The issue is as follows: I am making two requests to index.aspx. The first request comes back as a HTTP 200 (as I would expect), but the second request is retrieved from browser cache. I am clearing the cache at the start of each test to ensure the tests are consistent. I am also using a utility called HTTPWatch (a lot like fiddler, but shows requests even if they are retrieved from browser cache) which shows me HTTP information and this is how I know it is coming from the cache.
The issue only occurs on one of my machines.
Colleagues Machine (Works fine)
- Request is sent to index.aspx
- Headers Sent:
- (Request-Line): GET /index.aspx HTTP/1.1
- Accept: text/html, application/xhtml+xml, /
- Accept-Encoding: gzip, deflate
- Accept-Language: en-GB
- Connection: Keep-Alive
- Cookie: (Not relevant)
- Host: dev
- User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
- Headers received:
- (Status-Line): HTTP/1.1 200 OK
- Cache-Control: private
- Content-Length: 10369
- Content-Type: text/html; charset=utf-8
- Date: Wed, 08 Feb 2012 09:09:38 GMT
- Server: Microsoft-IIS/7.5
- X-AspNet-Version: 2.0.50727
- X-Powered-By: ASP.NET
- Second Request Sent to index.aspx
- Headers Sent:
- (Request-Line): GET /index.aspx HTTP/1.1
- Accept: text/html, application/xhtml+xml, /
- Accept-Encoding: gzip, deflate
- Accept-Language: en-GB
- Connection: Keep-Alive
- Cookie: (Not relevant)
- Host: dev
- Referer: http://dev/index.aspx
- User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
- Headers received:
- (Status-Line): HTTP/1.1 200 OK
- Cache-Control: private
- Content-Length: 33588
- Content-Type: text/html; charset=utf-8
- Date: Wed, 08 Feb 2012 09:09:38 GMT
- Server: Microsoft-IIS/7.5
- X-AspNet-Version: 2.0.50727
- X-Powered-By: ASP.NET
My Machine (Doesn't work)
- Request is sent to index.aspx
- Headers Sent:
- (Request-Line): GET /index.aspx HTTP/1.1
- Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, /
- Accept-Encoding: gzip, deflate
- Accept-Language: en-GB
- Connection: Keep-Alive
- Cookie: (Not relevant)
- Host: dev
- User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
- Headers received:
- (Status-Line): HTTP/1.1 200 OK
- Cache-Control: private
- Content-Length: 10374
- Content-Type: text/html; charset=utf-8
- Date: Wed, 08 Feb 2012 09:45:304GMT
- X-Powered-By: ASP.NET
- Second Request Sent to index.aspx
- Headers Sent:
- (None): No Headers sent for cached items
- Headers received:
- (None): No headers received for cached items
As you may have noticed, the browsers are different (ie8 to ie9), but I still can't see why this would be an issue. I think it must be some browser configuration as the headers received on the first request are virtually the same.
If anyone can explain why the second request is being retrieved from cache, I would be very grateful.
OK - so I think I've resolved it.
It seems that IE had some stale cache somewhere that was not being cleared even when I explicitly cleared the cache.
I used ProcMon to monitor the process and see what file was being accessed when IE was fetching the file from cache. I saw that despite clearing my cache there was a directory being accessed in the following location:
C:\Users\%username%\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\%Random Characters%\
I deleted the contents of the C:\Users\%username%\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5 folder and now I do not seem to get the behaviour above.
I searched on google for other people having difficulty with clearing the Cache in IE, but could not find much.
Not too sure about this one to be honest!