SaaS CMS has officially launched! Learn more now.

MapContentRoute not picked up by routing


I have a strange problem that the episerver routing is not working for MapContentRoute in a specific project. I have tried the same code in another episerver demo project and it worked - so i presume something must be interfering with this one.

The project im trying to integrate with is a huge beast so theres a lot of old legacy code. but i have tried commenting out any handlers, filters etc but with no success. The routing is working because i can access episerver page urls, but the custom route i add does not get picked up and throws a 404. I can see it registered in the routes table, but have no idea how to debug this and find out what is happening.

What could be interfering with the routing and how could i debug this?



Mar 27, 2013 11:28

Does your not working project use a custom FURL provider?

That is if you look in config, which FurlProvider is used? And also which routing HttpModule is registered, is it EPiServer.Web.RoutingUrlRewriteModule or EPiServer.Web.UrlRewriteModule?

What I am thinking is that there is a FURL module that handles the request before the routes get a chance.

Mar 27, 2013 11:49

This is what is registered

 <add name="InitializationModule" type="EPiServer.Framework.Initialization.InitializationModule, EPiServer.Framework" preCondition="managedHandler" />
 <add name="UrlRewriteModule" type="EPiServer.Web.RoutingUrlRewriteModule, EPiServer" preCondition="managedHandler" />
 <add name="ShellRoutingModule" type="EPiServer.Shell.Web.Routing.ShellRoutingModule, EPiServer.Shell" />
 <remove name="WebDAVModule" />


I have compared the 2 web configs and cannot spot any obvious differences


Mar 27, 2013 11:58

I've just tried using this tool :

and i can see my route in the table, but there is no match at all. it (obviously) shows a match for the usual episerver urls.

Johan, i am using your example /shop/ route from

Mar 27, 2013 12:29

Is your route registered before the builtin EPiServer routes or after? If after you could try to register it before. It should not do any difference but just to make sure it is not the built in routes that hijacks the request.

Otherwise it seems like it is something that "handles" the request and returns a 404 before the routes get a chance, the question is what that is?

Mar 27, 2013 12:52

ok, so a bit more investigation and I realised that the routing is actually semi-working, but its routing through to the wrong content tree.

i have UK, US and Australia sites set up. Im accessing the UK site, but it is attempting to deliver the content from the Australia branch. which explains the 404. If i create the page structure in Australia, it delivers that content... despite the url pointing to the uk site.


Australia is the last <Site> in my episerver config. If I make UK the last site, then the content is delivered from the uk branch!!! it doesnt seem to be using the url to work out what site is active!

Edited, Mar 27, 2013 15:06

You can specifiy the content root from where your routing should start. You do this by assiging property UrlSegmentRouter on MapContentRouteParameters. You can assign it an instance of DefaultUrlSegmentRouter where you can assing the routing root in constructor parameter.

Mar 28, 2013 9:14


Whats the quickest way to do this ? (lest code?) it seems like a bug to me that the order of the <site> elements affects which it uses by default?

Edited, Apr 05, 2013 18:44

For anyone else trying this: the code is :

	var mapRouteParameters = new MapContentRouteParameters();
	mapRouteParameters.UrlSegmentRouter =
	  new DefaultUrlSegmentRouter(ServiceLocator.Current.GetInstance<IContentLoader>(),
	  new LanguageSelectorFactory(), 


May 20, 2013 11:40
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.