我需要将Company/Careers/OpenPosition
重定向到Company/OpenPosition
。为什么下面的MapRoute()调用不起作用?
谢谢。
routes.MapRoute(
"Company", // Route name
"Careers/OpenPosition/{action}", // URL with parameters
new { controller = "Company", action = "OpenPosition" } // Parameter defaults
);
答案 0 :(得分:2)
如下所示:
routes.MapRoute( "Company", // Route name
"Company/Careers/OpenPosition/",
new { controller = "Company", action = "OpenPosition" } );
或
routes.MapRoute( "Company", // Route name
"Company/Careers/OpenPosition/{customVariable}",
new { controller = "Company", action = "OpenPosition" } );
答案 1 :(得分:0)
如下所示:
routes.MapRoute( "Company", // Route name
"Company/Careers/OpenPosition/",
new { controller = "Company", action = "OpenPosition" } );
或
routes.MapRoute( "Company", // Route name
"Company/Careers/OpenPosition/{customVariable}",
new { controller = "Company", action = "OpenPosition" } );