2017-02-09 67 views
0

我在umbraco 7中有一个像http://localhost:55617/knowledge-house/magazines/这样的页面。现在我想应用路由到相同的参数在url中时出现http://localhost:55617/knowledge-house/magazines/English/2012/。其中'英语'&'2012'是参数。在umbraco 7中有多个参数的路由

因此,在RouteConfig.cs中,我编写了以下内容。

routes.MapRoute(
      name: "/knowledge-house/magazines/", 
      url: "/umbraco/Surface/{controller}/{action}/{langid}/{year}/", 
      defaults: new { controller = "Kids", action = "Magazine", langid = UrlParameter.Optional, year = UrlParameter.Optional } 
     ); 

我有儿童表面控制器,其中有一个代码如下。

public ActionResult Magazine(int langid = 0, string year = "") 
    { 
     return View("Magazine"); 
    } 

但对于URL http://localhost:55617/knowledge-house/magazines/English/2012/提示错误:HTTP错误404.11 - 找不到

回答