---
title: Partial routing
slug: cms-12/docs/partial-routing
docTags: 
createdAt: 2026-08-10T15:56:03.000Z
---

Partial routing lets you extend routing beyond pages. You can use partial routing to route to data outside Optimizely CMS or other content types other than pages.

For example: `http://site/News/Sports/TheGame/`. The `http://site/News/` part can 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: `Sports/TheGame/`.

## IPartialRouter interface

Each partial router must implement the interface `EPiServer.Core.Routing.IPartialRouter<TContent, TRoutedData>`, which 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` – Called when the ordinary page routing has routed to a page of type `TContent`, and there is a remaining part of the URL. The implementation can then route the remaining part of the URL.
- `GetPartialVirtualPath` – Called when an outgoing URL is constructed for a content instance of type `TOutgoing`.

## Pass RouteValues to Controller

`UrlResolverContext.RouteValues` in `RoutePartial` method reflects `HttpContext.RouteValues`, which is unchangeable in ASP Net Core.

To add additional data to `RouteValues`you must use `IHttpContextAccessor.HttpContext.Items` or `IHttpContextAccessor.HttpContext.Request.RouteValues`. For example:

```csharp
public class NewsPartialRouter: IPartialRouter<NewsContainer, NewsContent> {
  private readonly IHttpContextAccessor _contextAccessor;

  public object RoutePartial(NewsContainer content, UrlResolverContext urlResolverContext) {
    _contextAccessor.HttpContext.Request.RouteValues.Add("paramName", paramValue);
    // or
    _contextAccessor.HttpContext.Item.Add("paramName", paramValue);
    // MVC controller will be:
    // public IActionResult Index(NewsContainer currentContent, object paramName)
  }
}
```
