Does "Debug" invalidate ASP.Net MVC OutputCache?

Posted by William Edmondson on Stack Overflow See other posts from Stack Overflow or by William Edmondson
Published on 2010-03-22T14:11:30Z Indexed on 2010/03/22 14:21 UTC
Read the original article Hit count: 413

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");
}

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about mvc