November Happy Hour will be moved to Thursday December 5th.

EPi Routing

Vote:
 

I am very new to EPiServer and I'm struggling with the routing.  I want to have one page type called "Checkout".  With that page type I want to create layouta shipping, payment, and review page within the CMS under a root page called "Checkout". 

Checkout
             Shipping
             Payment
             Review

I am trying to figure out how I route "/MYSITE/Checkout/Shipping" to the Checkout controller and the shipping action.  If I don't create the page within the CMS it routes fine, which I'm assuming is because EPi routing is only finding "Checkout" as the node which is then using "Shipping" as the action.  However, when I create the Shipping page it uses "checkout/shipping" as the node which then routes to the Checkout controller, Index action.  

I'm not sure at this point that I really need to create the pages in the CMS, but I would still like to know if there is a way to do this. 

I have read every article that I can find, but for some reason I can't seem to get this working.  So without creating another page type for shipping, payment, review; each with their own controllers with an action of Index; is there a way to do this?

#139367
Sep 30, 2015 23:16
Vote:
 

In your global.asax.cs file in the RegisterRoutes method you need to add the routing rules for your controller:

protected override void RegisterRoutes(RouteCollection routes)
        {
            base.RegisterRoutes(routes);

            routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/{id}",
              defaults: new { action = "Index", id = UrlParameter.Optional });

        }

Same as with any ASP.NET MVC application. You should then be able to call your CheckoutController.

Hope this helps.

Frederik

#139369
Oct 01, 2015 2:26
* 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.