AI OnAI Off
A little more info:
context.RoutedContentLink is always 1 instead of the content routed
Hi
This is caused by a changed behaviour (not intentional) that was introduced in 7.5 which is that a custom route by default starts from RootPage and not StartPage. You can specify explicitly where to start route as in code below. I have reported a bug that we should change the default behaviour for custom routes so they by default starts from Start page and not Root. However that is a breaking behaviour change (again...) so that needs to go into next major.
public void Initialize(InitializationEngine context)
{
var segment = new SearchSegment("search");
var routingParameters = new MapContentRouteParameters()
{
SegmentMappings = new Dictionary<string, ISegment>()
};
routingParameters.SegmentMappings.Add("search", segment);
var urlSegmentRouter = context.Locate.Advanced.GetInstance<IUrlSegmentRouter>();
urlSegmentRouter.RootResolver = (s) => s.StartPage;
routingParameters.UrlSegmentRouter = urlSegmentRouter;
RouteTable.Routes.MapContentRoute(
name: "searchterms",
url: "{language}/{node}/{search}",
defaults: new { action = "index" },
parameters: routingParameters);
}
We are using segment mapping on one customer to solve a that the user can send in what to search for.
For example: http://www.lernia.se/sok/jobb/
To solve this we use this code:
The urgent problem we have after upgraded to tha latest version of EPiServer is that this always returns null: context.LastConsumedFragment
This is the more simple segment routing we have, we also have another more complex where the user can type for example:
http://www.lernia.se/utbildning/solna/fordonsteknik/
This will return all educations about fordonsteknik in solna and the way we solve that is that parsing through the RemainingPath but this does not work either since the first check on LastConsumedFragment is null.
I do not know how to solve this, so Please help!