Registering Routes in nopCommerce

nopCommerce is based on ASP.NET (MVC) and it follows the IRouteProvider interface for registering the routes during the application start event. All the routes are registered in the “Route Provider” class in the Nop.Web project.

In order to view the “Route Provider” class, go to: Nop.Web/Infrastructure/RouteProvider.cs.


You will see the route registration of the pages like homepage, login & shopping cart etc:

using System.Web.Mvc;
using System.Web.Routing;
using Nop.Web.Framework.Localization;
using Nop.Web.Framework.Mvc.Routes;

namespace Nop.Web.Infrastructure
    public partial class RouteProvider : IRouteProvider
        public void RegisterRoutes(RouteCollection routes)
            //We reordered our routes so the most used ones are on top. It can improve performance.

            //home page
                            new { controller = "Home", action = "Index" },
                            new[] { "Nop.Web.Controllers" });

            //we have this route for performance optimization because named routes are MUCH faster than usual Html.Action(...)
            //and this route is highly used
                            new { controller = "Widget", action = "WidgetsByZone" },
                            new[] { "Nop.Web.Controllers" });

                            new { controller = "MyNewPage", action = "Index" },
                            new[] { "Nop.Web.Controllers" });

                            new { controller = "Customer", action = "Login" },
                            new[] { "Nop.Web.Controllers" });
                            new { controller = "Customer", action = "Register" },
                            new[] { "Nop.Web.Controllers" });
                            new { controller = "Customer", action = "Logout" },
                            new[] { "Nop.Web.Controllers" });

            //shopping cart
                            new { controller = "ShoppingCart", action = "Cart" },
                            new[] { "Nop.Web.Controllers" });
                            new { controller = "ShoppingCart", action = "Wishlist", customerGuid = UrlParameter.Optional },
                            new[] { "Nop.Web.Controllers" });


You can use this “Route Provider” class for the following:

  • Plugins custom routes
  • New custom pages


Example of registering route for Contact us page in nopCommerce:

 //contact us
                            new { controller = "Common", action = "ContactUs" },
                            new[] { "Nop.Web.Controllers" });

Hope it helps!


 Looking for quality nopCommerce Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , | Posted under nopCommerce | RSS 2.0

Author Spotlight

Lavish Kumar

Founder, developer and owner of - By profession, he is a software programmer / web developer, web designer & DBA. He is passionate about technology and electronic gadgets. He enjoys writing tech articles and developing web applications. He is a nopCommerce MVP and author of official nopCommerce Designer's Guide.

Leave a Reply

Your email address will not be published. Required fields are marked *