public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Details", url: "{controller}/{action}/{id}/{t}", defaults: new { action = "Details" }, constraints: new { id = @"d+", t = @"d+" } //路由约束 用于约束id和t为0到多个数字组成,当id或t为非数字时,会跳过这个路由,而尝试由下一个路由来匹配。 ); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); }