ASP.Net MVC 3.
I found similar questions/answers, but none seem to fix this issue...
Similar: HttpResponse.RemoveOutputCacheItem is not working
How to "invalidate" portions of ASP.NET MVC output cache?
I am using OutputCache to cache a FileContentResult (an image).
My action looks like this:
[HttpGet]
[OutputCache(Location = OutputCacheLocation.Client, Duration = 300, VaryByParam = "id")]
public FileContentResult Photo(int id) {
byte[] photo = //GetPhoto;
return File(photo,"image/jpeg");
}
In my view I have to following:
<img src="@Url.Action("Photo", "Client", new {id = Model.Id})"/>
This works fine, and the output caching is working as expected....Now the problem
I am trying to reset the cache after an update.
The code in the action that updates looks like this:
var url = Url.Action("Photo", "Client", new {id = Model.Id});
Response.RemoveOutputCacheItem(url);
The problem is the cache doesn't reset. When I debug, I can't find where the cache object is (I tried System.Web.HttpContext.Current.Cache, but that doesn't seem to have the cached item).
Thanks for any help!