0

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

//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" }
                );
4

1 回答 1

0

最后我在NOP.Web->Infrastructure->RouteProvider.cs下的NOP2.65 all route register中得到了解决方案。如果你想设置不同的路线,那么你的 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 设置为空白

于 2012-09-26T07:33:03.027 回答