我想知道您是否可以向我展示在 ASP.NET MVC(1 和 2)中声明路由的所有各种方法。请解释定义路由的每种方法,如何使用它,以及它涵盖的情况。
这是我希望在这里收集的示例:
routes.MapRoute("Directors",
"Directors/{filter}/{skip}",
new { controller = "Directors", action = "Index", skip = 0, filter = "" },
new { skip = @"\d+", filter = @"^[a-zA-Z]+.+" });
Directors
=路线的名称。 Directors/{filter}/{skip}
= 网址定义。 new { controller = "Directors", action = "Index", skip = 0, filter = "" }
= 此路由的默认值。 new { skip = @"\d+", filter = @"^[a-zA-Z]+.+" }
= 这条路线的约束。