2017-02-09 19 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 - 找不到

回答