我的访问控制器:
public ActionResult Index(Visits visits, int? id)
{
....
return View(v);
}
这是我的路线配置
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index",
id = UrlParameter.Optional }
);
}
Works: http://localhost:49225/Visits
Does not work: http://localhost:49225/Visits/123
自定义路由是什么(并强制它是一个整数)?