context.MapRoute(
                name: "Test1",   //路由名称 唯一
                url: "Admin/{controller}/{action}/{year}/{month}/{day}", //URL规则(分区需增加区域名称常量,此处为Admin)
                defaults: new { controller="Home",action="Index" },   //默认值
                constraints: new  { year=@"\d{4}",month=@"\d{2}",day=@"\d{2}"},  //约束 此处限制年 需为4位数字
                namespaces: new string[] { "TestAreas.Areas.Admin.Controllers" }  //命名空间,有分区时,为了避免多个控制器重名,主项目也需增加namespaces
                );

 

相关文章:

  • 2022-01-21
  • 2022-12-23
  • 2021-12-05
  • 2021-11-24
  • 2021-08-31
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-15
  • 2022-01-13
  • 2022-01-17
相关资源
相似解决方案