- Framework reference
- EPiServer.Web.Routing Namespace
- IPartialRouter(TContent, TRoutedData) Interface
Assembly: EPiServer (in EPiServer.dll) Version: 10.10.4.0 (10.10.4.0)
Implement to take care of partial routing below a routed content instance.
RoutePartial( TContent content, SegmentContext segmentContext )
During routing of an incoming request first the url will be parsed from left for pages as long as there is matches. If there is a remaining part (not matched by any page) after page routing then there is a check if there is any IPartialRouter registered for the the type of the found page. If so that implementation is called to se if it can route the remaining part.
An example would be an url like http://sitehost/aPage/extendedPart/extendedContent/. If there is a page matching url http://sitehost/aPage/ then if an IPartialRouter is registered for the type matching aPage that instance will be called to route the part extendedPart/extendedContent/.
Most commonly the returned data is of type TRoutedData. But there might be cases where it is something else, an example is in the Relate package where the returned object is in parameter content.
The below example is a partial router that routes URLs like 'http://sitehost/News/Sport/A%20News/'. In the example
the URL part 'http://sitehost/News/' is to a page of type NewsContainer while the part 'Sport/A%20News' is handled
by the partial router.
public object RoutePartial(NewsContainer content, SegmentContext segmentContext)
//The format we handle is category/Name/
NewsContent newsContent = null;
//Use helper method GetNextValue to get the next part from the URL
var nextSegment = segmentContext.GetNextValue(segmentContext.RemainingPath);