我有以下ActionMethod在UserController中默認指數法行爲的ASP.NET MVC
public ActionResult Index(string id, string name, int? org)
當我導航到>http://example.com/User,上述操作方法被調用。那很好。
但是,當我導航到>http://example.com/User/1時,它找不到資源。它不應該導航到id = 1的上述操作方法,其餘的爲null?
路由在Global.asax中:
context.MapRoute(
"Default",
"/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
你在global.asax中看起來像什麼? – Jon 2011-02-04 12:01:39