mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
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).
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user