對於下面的控制器,爲什麼http://localhost:port/content/about的調用不會傳遞「about」作爲索引控制器的頁面參數的值?默認路由。顯然我不明白路由...如何更改mvc動態頁面路由URL - 爲什麼這不起作用?
public class ContentController : Controller
{
private IContentService _service;
public ContentController()
{
_service = new ContentService(new ModelStateWrapper(this.ModelState), new ContentRepository());
}
public ActionResult Index(string page)
{
return RedirectToAction("View", new { p = page });
}
public ActionResult Page(string p)
{
ContentPage contentPage = _service.GetPageContent(site, p);
return View(contentPage);
}
}
請張貼您的路線設置。 – Min 2009-11-02 18:18:34
這是用默認的asp.net mvc install – 2009-11-02 18:20:07