PartialRouter for Simple Address



I'm quite new to EPi - working about half a year, and most of issues I had, was successfully solved with help of this forum and some EPi related blogs (jondjones; mathiaskunto). This time I'm having issue I can't deal with and hoping for advice from more experienced developers.

CMS version: 10.10.4

The Issue

I have implemented partial router for specific page which just fetches two segments with strings and stores these into RouteData and also simple InitializationModule to register this router.

Everythings is working fine if I'm using full url to navigate to page - I can retrieve data in particular page controller from RouteData ( RouteData.Values[]).

Issue begins when I'm using Simple Address for that page - pages without these additional segments are working fine (routed & rendered), but page with these parameters are returning 404 error.

OK: http://localhost/en/all-posts/post-details/year/number (particular post - full hierarchy)
OK: http://localhost/all-posts/post-details/year/number (particular post - full hierarchy)
OK: http://localhost/en/all-posts (all post - full hierarchy)
OK: http://localhost/posts (all post - full hierarchy)

404: http://localhost/post/year/number (particular post - simple address)
Fail: http://localhost/post (particular post - simple address. Reaches controller but no RouteData)

Am I missing something? How can I make partial router work with SimpleAddress?

Hope that you understand my struggle :D

Used code parts

public class PostViewPagePartialRouter : IPartialRouter
	public PartialRouteData GetPartialVirtualPath(PostViewPage content, string language, RouteValueDictionary routeValues, RequestContext requestContext)
		return null;

	public object RoutePartial(PostViewPage content, SegmentContext segmentContext)
		var nextValue = segmentContext.GetNextValue(segmentContext.RemainingPath);

			segmentContext.RouteData.Values["year"] = nextValue.Next;
			segmentContext.RouteData.Values["number"] = nextValue.Remaining;
			segmentContext.RemainingPath = string.Empty;
		catch { }

		return content;

public class PartialRoutersInitialization : IInitializableModule
	public void Initialize(InitializationEngine context)
		RouteTable.Routes.RegisterPartialRouter(new PostViewPagePartialRouter());

	public void Uninitialize(InitializationEngine context)
		//Add uninitialization logic
Nov 08, 2018 10:48

I have a bit similar problem, although we don't even have custom router. In our case we have implemented special action method to base page controller that is called from our UI on all pages to get some client resources. Logic in UI is simple, it will just append the action method name to current url to get the client resources, for example  on page with URL the UI calls to get the resouce. This works well when using "normal" URLs but now realized that this fails when the page is accessed with simple url. So the normal action method routing does not work anymore. Seems this would require some custom handling for simple urls, need to investigate more.


Feb 01, 2019 10:11
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.