在网上查了一些资料 关于这个写的都很简单,没得实际应用。

参考了一下别人的代码,写篇博文记录一下。

 

首先目录结构:

MVC Areas的使用

 

然后主要是 BaseAreaRegistration 文件内容

 

    public class BaseAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Base";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Base_default",
                "Base/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional }
            );
        }
    }

 

Global.asax 中需要添加一句

            AreaRegistration.RegisterAllAreas();

 

相关文章:

  • 2021-12-22
  • 2021-12-23
  • 2021-05-16
  • 2021-08-09
  • 2022-01-07
  • 2022-12-23
  • 2022-02-01
猜你喜欢
  • 2021-12-06
  • 2022-03-02
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
相关资源
相似解决方案