Does "Debug" invalidate ASP.Net MVC OutputCache?
- by William Edmondson
I have images stored in a database and am serving them from an MVC controller as "FileResult". If I run the MVC application from Visual Studio 2008 in debug mode and set a break point inside the controller method the debugger intercepts the call on every page refresh regardless of my "OutputCache" settings.
Does the VS debugger invalidate the OutputCache or is there something else going on here?
[OutputCache(Duration = 86400, VaryByParam = "id")]
public FileResult Index(string id)
{
byte[] image;
int imageId;
int.TryParse(id, out imageId);
using (var ctx = new EPEntities())
{
var imageObj = (from images in ctx.Images
where images.ID == imageId
select images).FirstOrDefault();
image = imageObj.Image;
}
return new FileContentResult(image, "image/gif");
}