如何在nopCommerce中更改默认路由

时间:2016-08-25 10:22:22

标签: asp.net-mvc asp.net-mvc-routing nopcommerce

我正在使用nopCommerce,我想将默认路线从索引更改为另一个ActionResult 促销,该路线也存在于同一{ {1}},我已经完成了以下技巧,但没有解决方案,

在Nop.Web \ Infrastructure \ RouteProvider.cs

HomeController
Global.asax中的

 //home page
            routes.MapLocalizedRoute("HomePage",
                            "",
                            new { controller = "Home", action = "Index" },
                            new[] { "Nop.Web.Controllers" });
            //for promotion
            routes.MapLocalizedRoute("Promotion",
                            "",
                            new { controller = "Home", action = "Promotion" },
                            new[] { "Nop.Web.Controllers" });

1 个答案:

答案 0 :(得分:0)

我通过在默认路由中添加值Home作为url名称找到了解决方案,我发现我在Global.asax中将Action更改为Index。这很好。

//home page
            routes.MapLocalizedRoute("HomePage",
                            "Home", // added value in the default route
                            new { controller = "Home", action = "Index" },
                            new[] { "Nop.Web.Controllers" });
            //for promotion
            routes.MapLocalizedRoute("Promotion",
                            "",
                            new { controller = "Home", action = "Promotion" },
                            new[] { "Nop.Web.Controllers" });