mirror of
https://github.com/rudollee/LearningMVC.git
synced 2026-08-11 16:32:55 +00:00
Ch. 16 Routing Adv (until 16-5)
This commit is contained in:
@@ -63,11 +63,18 @@ namespace UrlsAndRoutes
|
||||
// new { controller = "^H.*", action = "^Index|About", httpMethod = new HttpMethodConstraint("GET"), id = new RangeRouteConstraint(10, 20) },
|
||||
// new[] { "URLsAndROutes.Controllers" });
|
||||
|
||||
routes.MapRoute("MyRoute", "{controller}/{action}/{id}/{*catchall}",
|
||||
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
|
||||
new { controller = "^H.*", action = "^Index|About", httpMethod = new HttpMethodConstraint("GET"),
|
||||
id = new CompoundRouteConstraint(new IRouteConstraint[] { new AlphaRouteConstraint(), new MinLengthRouteConstraint(6) }) },
|
||||
new[] { "URLsAndROutes.Controllers" });
|
||||
//routes.MapRoute("MyRoute", "{controller}/{action}/{id}/{*catchall}",
|
||||
// new { controller = "Home", action = "Index", id = UrlParameter.Optional },
|
||||
// new { controller = "^H.*", action = "^Index|About", httpMethod = new HttpMethodConstraint("GET"),
|
||||
// id = new CompoundRouteConstraint(new IRouteConstraint[] { new AlphaRouteConstraint(), new MinLengthRouteConstraint(6) }) },
|
||||
// new[] { "URLsAndROutes.Controllers" });
|
||||
|
||||
routes.MapMvcAttributeRoutes();
|
||||
|
||||
routes.MapRoute("NewRoute", "App/Do{action}", new { controller = "Home" });
|
||||
|
||||
routes.MapRoute("MyRoute", "{controller}/{action}/{id}",
|
||||
new { controller = "Home", action = "Index", id = UrlParameter.Optional });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user