MVC的路由

时间:2021-03-21 19:17:59

MVC的路由包括以下几部分

路由名称,路由URL,路由的初始值,路由的约束,路由的命名空间

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
constraints: new { controller = "^H.*" },
namespaces: new[] { "SimpleMVC" }
);// 断点2