AI OnAI Off
If your partial router handles the segment then it needs to consume it, that is update ReminingPath on the segment context, something like:
var segmentPair = context.GetNextValue(context.RemainingPath); if (<your condition to handle segment>) { //update remaining path context.RemainingPath = segmentPair.Remaining; ...morecode return yourdata; } return null;
Hi
I am trying to create a partial route.
public class TrendPagePartialRouter : IPartialRouter
{
public PartialRouteData GetPartialVirtualPath(TlSiteArea content, string language, RouteValueDictionary routeValues, RequestContext requestContext)
{
return null;
}
public object RoutePartial(TlSiteArea content, SegmentContext segmentContext)
{
return content;
}
}
[InitializableModule]
[ModuleDependency(typeof(ServiceContainerInitialization))]
public class RouteConfig : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
RouteTable.Routes.RegisterPartialRouter(new TrendPagePartialRouter());
}
public void Uninitialize(InitializationEngine context)
{
}
public void Preload(string[] parameters)
{
}
}
public class TlSiteAreaController : PageController
{
public ActionResult Index(TlSiteArea currentPage)
{
return Content("Hej hej " + currentPage.Name);
}
}
RoutePartial is called and returns the correct page that is TlSiteArea.
I've tested this on an Alloy website and it worked well but running this code on our client’s solution returns a 404.