在添加多个Area时,如添加:AreaTest ,需求修改AreaTestAreaRegistration.cs
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
public class AreaTestAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "AreaTest";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"AreaTest_default",
"AreaTest/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
null,
new string[] { "Mini.WebAppMvc3.Areas.AreaTest.Controllers.*" }
);
}
}
修改RegisterArea方法,添加两个参数.
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"AreaTest_default",
"AreaTest/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
null,
new string[] { "Mini.WebAppMvc3.Areas.AreaTest.Controllers.*" }
);
}