【发布时间】:2010-04-30 08:30:54
【问题描述】:
我正在使用 asp.net mvc 开发一个网站。我有路线
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
有用。
此方法是否必须具有相同的参数名称?还是我需要为这种情况创建单独的路线?
【问题讨论】:
标签: asp.net asp.net-mvc routing