MVC OutputCache issue
I am trying to cache the output of a controller action in MVC2 like this:
[OutputCache(Duration = 600, VaryByParam = "id", Location=System.Web.UI.OutputCacheLocation.Server)]
public FileContentResult GetImage(int id) {
}
When the user uploads a new image for their icon I invalidate the cache using the following line:
HttpResponse.RemoveOut开发者_如何学运维putCacheItem("/MyPage/GetImage/" + u.UserID.ToString());
However this doesn't seem to work and I can't figure out why
I am not sure about that but it appears to me that even if you use "Location=server" it might still cache at the client (as if there was no outputCache attribute at all) unless there is also "NoStore=true".
As such the problem might be a result of client side caching.
You can check if this is the case by examining the client side requests by using debugging tools such as fiddler or the ones that are built in into the browsers.
精彩评论