MVC中路由配置

1.Area区域中记得加命名空间区分相同的控制器

 public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
               this.AreaName + "_Default",
               this.AreaName + "/{controller}/{action}/{id}",
                new { area = this.AreaName, action = "Index", id = UrlParameter.Optional },
                new string[] { "SDTIWEB.Areas." + this.AreaName + ".Controllers" }  //命名空间
            );
        }

 

posted @ 2017-07-27 16:53  XinYiBuFang  阅读(167)  评论(0编辑  收藏  举报