From a0c3f97cb2d920b49911c2bd2eae3b911f406d73 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 1 Dec 2014 16:29:46 -0800 Subject: [PATCH] Adding support for StopRoutingHandler. Before this change, the StopRoutingHandler wouldn't work, since the wrapping HttpHandler would invoke the GetHttpHandler on the nested route handler, which in the case of StopRoutingHandler would throw a NotSupportedException. Maybe a better, more generic way would be to somehow identify which routing handlers should be wrapped and which shouldn't be, maybe based on the result of the GetVirtualPath method on the RouteData object (e.g. if it returns "null", don't wrap). --- src/Orchard/Mvc/Routes/ShellRoute.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Orchard/Mvc/Routes/ShellRoute.cs b/src/Orchard/Mvc/Routes/ShellRoute.cs index 3d11576e4..bb84db902 100644 --- a/src/Orchard/Mvc/Routes/ShellRoute.cs +++ b/src/Orchard/Mvc/Routes/ShellRoute.cs @@ -50,6 +50,11 @@ namespace Orchard.Mvc.Routes { if (routeData == null) return null; + // if a StopRoutingHandler was registered, no need to do anything further + if (routeData.RouteHandler is StopRoutingHandler) { + return routeData; + } + // otherwise wrap handler and return it routeData.RouteHandler = new RouteHandler(_workContextAccessor, routeData.RouteHandler, SessionState); routeData.DataTokens["IWorkContextAccessor"] = _workContextAccessor;