Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Loading...
Area: Optimizely CMS
ARCHIVED This content is retired and no longer maintained. See the latest version here.

Recommended reading 

Table of Contents

Introduction

Partial routing makes it possible to extend routing beyond pages. You can use partial routing either to route to data outside EPiServer CMS or to route to other content types than pages.

An example can be an URL like http://site/News/Sports/TheGame/. In the example the part of the URL that is http://site/News/ could represent the URL to a page instance of model type NewsContainer. Then by registering a partial router for ModelType NewsContainer the partial router can take care of routing the remaining part of the URL. In the example the partial router would take care of routing the part 'Sports/TheGame/'.

The IPartialRouter Interface

Each partial router must implement the interface EPiServer.Web.Routing.IPartialRouter<TContent, TRoutedData> that resides in the EPiServer.dll assembly. The interface is a generic interface with generic constraints where TContent : EPiServer.Core.IContent.

The interface contains the following methods:

  • RoutePartial. This method is called when the ordinary page routing has routed to a page of type TContent and there is a remaining part of the URL. The implemenation can then route the remaing part of the URL.
  • GetPartialVirtualPath. This method is called when an outgoing URL is constructed for a content instance of type TOutgoing.

See Also

  • For an example on an implementation, see Example of News Partial Routing. In Relate template package there is an implementation of partial routing for blogs and blog entries.
  • For more information about writing a Content Provider, see Content Providers. In the SDK framework reference there is more information on the EPiServer.Web.Routing.IPartialRouter<TContent, TRoutedData> and base class EPiServer.Core.ContentProvider.
Do you find this information helpful? Please log in to provide feedback.

Last updated: Mar 25, 2013

Recommended reading