I activate caching on my Visual Studio ASP.NET MVC4 project.
Here is the portion of code where I manage caching:
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(1));
filterContext.HttpContext.Response.Cache.SetValidUntilExpires(true);
filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.Public);
For testing I placed a breakpoint in the action Edit page. When I run my application and navigate to a specific page (an editing page) I can easily see that the action page is cached because the breakpoint is never reached. Next I cleared the cache with CTRL+F5 and navigate to the same Edit page. I expect to reach the breakpoint in my action Edit page but this is not the case. I never hit the Edit action page, never!?
Any idea why?
Thanks.