我期待使用下列網址和部分航線相應MVC3地圖路線
<domain>/Home/About
<domain>/Home/SiteList
<domain>/Site/<id>/ (this one is defaulted to the details view)
<domain>/Site/<id>/section1/ (this one goes to section1 route in the Site controller)
<domain>/Site/<id>/section2/ (this one goes to section2 route in the Site controller)
e.g.
<domain>/Site/london/siteinfo
以上爲
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
但是覆蓋地圖,我也想用以下途徑
<domain>/Site/<siteid>/section1/controller/action (where controller gets data linked to the <siteid> and action is optional)
示例鏈接將是:
<domain>/Site/london/siteinfo/manager (manager is a controller and will list managers for the site)
如果嘗試了各種路線並閱讀各種帖子,但無法找到適用於我的任何內容。
任何人都可以提供一些幫助嗎?
感謝 魯迪
是不是你的'{}行動'和'{ID}'切換? – GalacticCowboy
是的,我需要它。他們只會看到「細節」行爲,例如/site/london - 謝謝 –
Dudedolf