Areas in asp.net mvc, only one work at time

牧云@^-^@ 提交于 2019-12-06 09:01:21

I believe your area mappings should be structured like so.

public override void RegisterArea(AreaRegistrationContext context)
{
    context.MapRoute(
        "Admin_Default",
        "Admin/{controller}/{action}/{Id}",
        new { controller = "Admin", action = "Index", Id = (string)null }
    );
}

and

public override void RegisterArea(AreaRegistrationContext context)
{
    context.MapRoute(
        "Forum_Default",
        "Forum/{controller}/{action}/{Id}",
         new { controller = "Forum", action = "Index"}
    );
}

Keeps your routes from conflicting, which is what i think is happening in your case. As your default route matches your admin route.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!