【发布时间】:2016-10-26 20:18:19
【问题描述】:
假设我有两个网址
http://www.example.com/page/one
http://www.example.com/page/one/subOne
如何让它们由同一个控制器处理。目前正在处理顶部地址,但第二个地址正在由不呈现页面的回发函数处理。
所以对于我的路线配置,我有
routes.MapRoute("PageRule", "page/{id}", new { Controller = "document", action = "Index", id = UrlParameter.Optional });
routes.MapRoute("Page2Rule","page/{id}/{misc}", new { Controller = "document", action = "Index", id = UrlParameter.Optional });
在控制器中我有
// GET: Document
public ActionResult Index(string id, string misc )
和
// Post
[HttpPost]
public ActionResult postcomment(string gCaptcha,string txtName, string txtEmail, string txtMessage)
【问题讨论】:
标签: c# asp.net asp.net-mvc