2010-07-13 292 views
1

alt text http://img243.imageshack.us/img243/3249/50263677.jpgAsp.net的mvc路由問題

的Global.asax代碼:

routes.MapRoute(
"Default", // Route name 
"{controller}/{action}/{id}", // URL with parameters 
new { controller = "article", action = "article", id = UrlParameter.Optional } // Parameter defaults 
); 

我想使用URL路徑是這樣的:

www.domainname.com/文章/ 123/bla_article

如何做到這一點?

這項工作:www.domainname.com/article/article/123

這不行:www.domainname.com/article/123

請幫

回答

2

篩選:

routes.MapRoute( 
    "Article", 
    "Article/{id}", 
    new { controller = "article", action = "article", id = UrlParameter.Optional } 
); 
+0

是的,工作謝謝@Mark – Chicharito 2010-07-13 13:43:12

-1
routes.MapRoute(
"Default", // Route name 
"article/{action}/{id}", // URL with parameters 
new { action = "article", id = UrlParameter.Optional } // Parameter defaults 
); 
+1

此路線仍然是:/ article/article/123 – Mark 2010-07-13 13:40:46