代码之家  ›  专栏  ›  技术社区  ›  abenci

maproute()不工作

  •  0
  • abenci  · 技术社区  · 6 年前

    我需要重新定向 Company/Careers/OpenPosition Company/OpenPosition . 为什么下面的maproute()调用不起作用?

    谢谢。

    routes.MapRoute(
                "Company", // Route name
                "Careers/OpenPosition/{action}", // URL with parameters
                new { controller = "Company", action = "OpenPosition" } // Parameter defaults
            );
    
    2 回复  |  直到 6 年前
        1
  •  2
  •   Hossein    6 年前

    如下所示:

    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" } );
    
        2
  •  0
  •   Maarten B    6 年前

    如下所示:

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