9

Resolved

OutputCache returns nothing when a controller returns a FileResult

description

OutputCache module only allow the output of ViewResult. If you want to rerturn a FileResult in your controller and Output cache is activated, it returns nothing

Reason is this code within OutputCacheFilter.cs file:
  // only for ViewResult right now, as we don't want to handle redirects, HttpNotFound, ...
     if (filterContext.Result as ViewResultBase == null) {
         Logger.Debug("Ignoring none ViewResult response");
         return;
     }
You can read more info related with this problem in this discussion thread https://orchard.codeplex.com/discussions/455477

comments

dbertolin wrote Sep 30, 2013 at 1:27 PM

I have the same problem, there is workaround?

DeejayRaoul wrote Oct 7, 2013 at 12:42 PM

I've created a custom cropper tool outputting an image either from disk or real-time cropped from a stream.
This worked in 1.6 but has been broken in 1.7.
Any pointers as to where to fix this myself, or is there a fix allready in a recent version?

Piedone wrote Oct 7, 2013 at 1:45 PM

You could set up the route to be ignored until there's a fix.

sebastienros wrote Oct 8, 2013 at 5:35 PM

The bug is not related to the code you mention (outdated code) but as a workaround you can add [OutputCache(Duration = 0)] to your controller or your action

sebastienros wrote Oct 8, 2013 at 6:55 PM

Fixed in changeset dd852c33171437f6da6944aa78bbe779ad79de43