MapContentRoute throws exception

Vote:
 

I am trying to extend the episerver routing to add a /productid/ segment on the end of an episerver URL

I have added the following to my global asax

			routes.MapContentRoute(
				"ProductDetailsRoute", 
				"{language}/{node}/{partial}/{action}/{productid}", new
			{ 
				partial = UrlParameter.Optional,
				action = UrlParameter.Optional,
				productId = UrlParameter.Optional
			});

   

But it throws the following error when the application loads:

StructureMap Exception Code:  202
No Default Instance defined for PluginFamily System.Web.Routing.IRouteHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

How do i fix this? and is the above route registration the correct approach?

 

Thanks

#69513
Mar 26, 2013 15:42
Vote:
 

I have seen this but all I need is to pass through a UrlParameter. I dont want to fetch any data based on the url, just pass it through to the controller.

#69529
Mar 26, 2013 15:59
Vote:
 

Wrap your code in if(!ContentReference.IsNullOrEmpty(ContentReference.StartPage)).

 

Don't ask ;-)

#69530
Mar 26, 2013 16:03
Vote:
 

Thanks Joel, that seems to work. I wasnt overriding the register routes method either, so thats in place now.

So the route registered and i can see it in my route table, but its 404 ing now.

im trying to access Http://localhost/uk/path/to/page/detail/p123

where /uk/ is a virtual directory

/path/to/page/ is the episerver url path

/detail/ is the action

and /p123 is my required parameter

any ideas?

#69534
Mar 26, 2013 18:34
Vote:
 

just tried out the same code on another demo episerver site and it worked! not sure what else could be interfering.???

#69536
Mar 26, 2013 19:19
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.