Previously I built an pluggable mvc4 app with a concept of areas in MVC4 as described in this article. I was facing problem in deploying this app and I solved it as described here.
Now I want to go one step further. I want to use nested areas i.e. area within area. Following is my project structure:
Here MainProj is the main project whereas other projects are areas. Now, in CRM area I want to add Area "ManageAppointments" (this is the nested area)
I am able to add this sub area but facing problem in routing. View engine never finds views present within ManageAppointments area.
I supposed this problem is because, the routing is aware of the areas within the main project, but it is not aware of that there is area within area. In simpler way, routing is aware of CRM area but it never searches for MangeAppointment area within CRM area i.e. it is not aware that there is again another area within CRM area.
Currently my area registration for CRM and MangeAppointment is as follows:
CRM:
public class CRMAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "CRM";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"CRM_default",
"CRM/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
new string[] { "CRM.Controllers" }
);
}
}
MangeAppointment:
public class MangeAppointmentAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "MangeAppointment";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"MangeAppointment_default",
"MangeAppointment/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
new string[] { "MangeAppointment.Controllers" }
);
}
}
I think there is something wrong with MangeAppointment Area Registration. Thanks in advance.