是否有無論如何我可以減少重複mapRoute註冊在global.ascx文件中的多個頁面級別如下。Mvc maproute多個頁面級別
routes.MapRoute("Article-level1",
"{sluglevel1}/article/{id}/{article-title}",
new { controller = "article", action = "detail", id = UrlParameter.Optional });
routes.MapRoute("Article-level2",
"{sluglevel1}/{sluglevel2}/article/{id}/{article-title}",
new { controller = "article", action = "detail", id = UrlParameter.Optional });
routes.MapRoute("Article-level3",
"{sluglevel1}/{sluglevel2}/{sluglevel3}/article/{id}/{article-title}",
new { controller = "article", action = "detail", id = UrlParameter.Optional });
... more levels 4 to 10 ...
請讓我知道是否有更好的方法。
嗨,如果您發現有用的答案,請將其標記爲已解決,以便其他用戶可以看到您是如何解決問題的。 – polkduran 2013-05-16 09:17:56