If you want to keep your routing within the EPiServer context, you'll need to use MapContentRoute instead of the standard MVC MapRoute. I think for your particular case, I'd suggest keeping it in the EPiServer context.
I'm guessing you've checked out Joel's article on custom routing (http://joelabrahamsson.com/custom-routing-for-episerver-content/). There's also this forum post that I've found helpful (http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=65422).
What other things have you tried?
Hi Chris
Thank you very much for your response. It rurned out when I changed to use:
RouteTable.Routes.MapContentRoute
Instead of the RouteCollection it started working straight away. In case anyone else comes across this with a similar problem, my solution was:
RouteTable.Routes.MapContentRoute(
"ModalLayout",
"{language}/{node}/{action}/{variable}",
new { action = "modal" });
Many thanks for your help Chris
Kind Regards
Dave
Hi all
Really hoping someone can help me with this one. Im working on a version 7 MVC site. I have a page which it has its own template, but that page can also be loaded from else where in the site through a modal window, in this case it will have different HTML markup, there are also two options for the data that is displayed on that page, this option will toggle between a couple of properties available on the page.
So what I am trying to do is add a custom route to do two things:
The perfect URL structure would give me a URL structure like the following (where node is the page name alias from EPiServer):
www.mysite.com/{node}/{variable}/{method}/
Although I would still be very happy just with:
www.mysite.com/{node}/{method}/{variable}/
With the default routing in EPiServer the following works:
www.mysite.com/{node}/{method}
However as soon as you add the variable to the end, I get a 404. I have tried adding the following custom route to the RegisterRoutes override in the Global.asax file:
routes.MapRoute(
"ModalLayout", // Route name
"{node}/{action}/{myvariable}/", // URL with parameters
new { controller = "MyController", action = "Index", myvariable = "defaultvalue" });
I have tried several variations of the above including adding the controller to the URL but I get 404 errors with everything I try. Can anyone recommend the best way to approach this?
Many Thanks
Kind Regards
Dave