5
爲什麼路線http://localhost:2222/2012-adidas-spring-classic/37
不能從下面的路線匹配中獲取?我收到一個404錯誤。Route Constraint Isnt適用於ASP.NET MVC
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{*vti_inf}", new { vti_inf = @"(.*/)?_vti_inf.html(/.*)?" });
routes.IgnoreRoute("{*vti_rpc}", new { vti_rpc = @"(.*/)?_vti_rpc(/.*)?" });
#region API
routes.MapRouteLowercase(
"NamedHomeEvent",
"{year}-{name}/{Id}",
new { controller = "Event", action = "Index", year = DateTime.Now.Year },
new { year = @"\d{4}", Id = @"\d+" }
);
public virtual ActionResult Index(int? id, int? year, string name)
{
你也可以使用http://getglimpse.com/調試路線(以及更多) (http://getglimpse.com/Help/Plugin/Routes) – robasta