Hi,
I've been using this code to exclude default action segment and registering it from Global.asax like this.
This does not seem to work in 7.5 any longer, but nothing in Johan's post suggests so.
The problem is that context.RoutedContentLink is always SysRoot and not the page I am currently accessing (in EPi 7.1, this is not the case).
However, there has been a change in how DefaultUrlSegmentRouter is instantiated, so my Global.asax looks like this now:
protected override void RegisterRoutes(RouteCollection routes) { base.RegisterRoutes(routes); IContentLoader contentLoader; ServiceLocator.Current.TryGetExistingInstance(out contentLoader); var urlSegmentRouter = DefaultUrlSegmentRouter.Create(ServiceLocator.Current); if (contentLoader != null && urlSegmentRouter != null) { var segment = new OptionalActionSegment("action", contentLoader); var routingParameters = new MapContentRouteParameters { SegmentMappings = new Dictionary<string, ISegment>(), UrlSegmentRouter = urlSegmentRouter }; routingParameters.SegmentMappings.Add("action", segment); routes.MapContentRoute( name: "optionalaction", url: "{language}/{node}/{partial}/{action}/{anchorOnPage}", defaults: new { action = "Index" }, parameters: routingParameters); } }
Am I missing something here or is there a bug?
Got it http://www.mogul.com/en/about-mogul/blog/registering-a-route-with-an-optional-action-segment-in-episerver-75-and-on
Hi,
I've been using this code to exclude default action segment and registering it from Global.asax like this.
This does not seem to work in 7.5 any longer, but nothing in Johan's post suggests so.
The problem is that context.RoutedContentLink is always SysRoot and not the page I am currently accessing (in EPi 7.1, this is not the case).
However, there has been a change in how DefaultUrlSegmentRouter is instantiated, so my Global.asax looks like this now:
Am I missing something here or is there a bug?