I have an MVC3 application. I have an action, Action1, which redirects to another action, Action2, via RedirectToAction
. This results in an HTTP 302 response. The response appears to be cached somewhere because subsequent calls to Action1 never hit the server. I have tried the following:
- Set the output cache in the Web.config to disabled.
- Cleared my browser's (Chrome and IE9) cache.
- Appended a random number to the request for Action1.
- Changed what Action1 does to see if it would trigger the cache to die.
- Disabled my network connection thinking that somehow my localhost requests were being cached in a router or something.
No matter what I do, it seems that there is a layer of caching somewhere that still exists. I am running the application in IIS 7.5 locally on my laptop. I am accessing it from the same machine. My only final thought is that IIS is caching the redirection somewhere - but I can't figure out where that might be. Th only other thing that may be worth mentioning is that I am posting the request by creating a form on the fly and submitting it using jQuery.
Here are the request headers when I request Action1:
POST /Test/Action1
Host: localhost
Connection: keep-alive
Content-Length: 36
Cache-Control: max-age=0
Origin: http://localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://localhost/Test
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: CartID=2637139; ASP.NET_SessionId=njto1i55dsbfsib5x2vpin55; siteuidut=6750fc9eda6c479db11ce10328a595ec; UserID=1; .ASPXAUTH=0:6172Tz9ggmhlHKcOJE+Jmg==
Here are the response headers:
HTTP/1.1 302 Found
Cache-Control: private, s-maxage=0
Content-Type: text/html; charset=utf-8
Location: /Test/Action2
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 3.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 20 Jul 2012 00:42:59 GMT
Content-Length: 140