Doesn't work w/ Files?


Does this attribute work with files? Looking through the source code it seems to be using ContentResult? My action returns a file.

    [DonutOutputCache(Location = OutputCacheLocation.Client, Duration = 300, VaryByParam = "id")]
    public FileContentResult GetPhoto80x80(int id) {
                    //code to get image..
                return File(client.Photo80x80, client.PhotoMimeType);
And I call like this:

<img src="@Url.Action("GetPhoto80x80", "Images", new {id=Model.Id})" height="80" width="80" />

I receive following error:

outputstream is not available when a custom textwriter is used
Closed Sep 11, 2013 at 4:02 PM by moonpyk
In memory cache is not suited for storing images (or other binary data). IMHO, you should store you result images on the disk and serve them through the classic IIS pipeline.


DevTrends wrote Feb 16, 2012 at 8:39 AM

No, it only deals with text based results at the moment though compatibility with binary data is something that we are looking into.