Tại sao tuyến đường http://localhost:2222/2012-adidas-spring-classic/37
, không được chọn từ tuyến đường bên dưới? Tôi gặp lỗi 404.Đường giới hạn không hoạt động cho 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)
{
bạn cũng có thể sử dụng http://getglimpse.com/ các tuyến debug (và nhiều hơn nữa) (http://getglimpse.com/Help/Plugin/Routes) – robasta