如何在NOPCommerce2.65中设置不同的默认页面

时间:2012-09-21 10:28:23

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

我想在nop2.65中设置不同的默认页面,我已注册新的路由

//In RouteProvider
//Custome page
            routes.MapLocalizedRoute("CustomHome",
                            "",
                            new { controller = "Customer", action = "Login" },
                            new[] { "Nop.Web.Controllers" });

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

工作正常将登录页面设置为默认,但当我点击“主页”菜单时,它会重定向登录页面 而不是主页 我也尝试在Global.asax文件中设置默认页面,但也无法正常工作

//In Global.asax file
    routes.MapRoute(
                    "Default", // Route name
                    "{controller}/{action}/{id}", // URL with parameters
                    new { controller = "Customer", action = "Login", id = UrlParameter.Optional },
                    new[] { "Nop.Web.Controllers" }
                );

1 个答案:

答案 0 :(得分:0)

最后,我在NOP.Web-> Infrastructure-> RouteProvider.cs下的NOP2.65所有路由寄存器中得到了解决方案。如果你想设置不同的路线,那么你的RouteProvider.cs就像

/In RouteProvider
//Custome page
            routes.MapLocalizedRoute("CustomHome",
                            "", // Route name
                            new { controller = "Customer", action = "Login" },
                            new[] { "Nop.Web.Controllers" });

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

注意:对于新注册的路由和修改的HomePage RouteName,将 RouteName 设置为空白。