我正在asp.net mvc的网站上工作。我有路线asp.net mvc routing id参数
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
// Parameter defaults
);
这是默认路线。我有一个方法
public ActionResult ErrorPage(int errorno)
{
return View();
}
现在,如果我要运行与http://something/mycontroller/Errorpage/1 这个代码不工作。但是,如果我将参数名称从errorno
更改为ID,它就可以工作。
该方法是否必须具有相同的参数名称?还是我需要为这种情况创建单独的路线?
重复:http://stackoverflow.com/questions/2030614/asp-net-mvc-action-parameter-naming – 2010-12-10 11:54:41