Sad*_*egh 0 routes constraints asp.net-mvc-2
这是我正在使用的代码,但是编译器说:匿名类型不能具有相同名称的多个属性
context.MapRoute("RouteName", "statics/category/{fileName}",
new
{
controller = "myController",
action = "Index"
},
new
{
fileName = new fnRouteConstraint(),
fileName = new AnotherRouteConstraint()
});
Run Code Online (Sandbox Code Playgroud)
给出约束名称:
routes.MapRoute(
name: "app2",
url: "app/{id}",
defaults: new { controller = "App", action = "Index", id = UrlParameter.Optional },
constraints: new { RouteConstraint1 = new RouteConstraint1(),
RouteConstraint2 = new RouteConstraint2()
}
);
Run Code Online (Sandbox Code Playgroud)