From 378f764a8371ba88ac66abc8532a15778954abb5 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Tue, 6 Aug 2013 16:33:46 -0700 Subject: [PATCH] #19984: Output cache was not serving non ViewResult actions Work Item: 19984 --- .../Orchard.OutputCache/Filters/OutputCacheFilter.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index f013680b0..f5777e605 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -9,6 +9,7 @@ using System.Text; using System.Web; using System.Web.Mvc; using System.Web.Routing; +using Orchard.Core.Feeds.Rss; using Orchard.OutputCache.Models; using Orchard.OutputCache.Services; using Orchard.Caching; @@ -254,6 +255,11 @@ namespace Orchard.OutputCache.Filters { public void OnActionExecuted(ActionExecutedContext filterContext) { + // only cache view results, but don't return already as we still need to process redirections + if (!(filterContext.Result is ViewResultBase) && !(filterContext.Result is RssResult)) { + _filter = null; + } + // ignore error results from cache if (filterContext.HttpContext.Response.StatusCode != (int)HttpStatusCode.OK) { @@ -340,12 +346,6 @@ namespace Orchard.OutputCache.Filters { // save the result only if the content can be intercepted if (_filter == null) return; - // 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; - } - // check if there is a specific rule not to cache the whole route var configurations = _cacheService.GetRouteConfigurations(); var route = filterContext.Controller.ControllerContext.RouteData.Route;