Asp.Net MVC3(一)-多Area时,路由设置问题

在添加多个Area时,如添加:AreaTest ,需求修改AreaTestAreaRegistration.cs

 

View Code
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.*" }
);
}

 

posted @ 2012-02-03 16:07  南阳·源  阅读(1005)  评论(2编辑  收藏  举报