I am working on a project that has a presentation layer with several Areas, and it is difficult for me to test the application, since the controllers and views that I am developing, are in a defined area.
I was looking for information about working with areas, and although the definition of the area is clear, I can not establish that when I start the application, the driver and view by default, are the ones that I indicated in the configuration.
In the RouteConfig.cs
file, I tego this:
using System.Web.Mvc;
using System.Web.Routing;
namespace XXX.Inv.Odin.Web
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//routes.MapRoute(
// name: "Default",
// url: "{controller}/{action}/{id}",
// defaults: new { controller = "NegocioCompra", action = "Index", id = UrlParameter.Optional }
//);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
//defaults: new { controller = "NegocioCompra", action = "Index", id = UrlParameter.Optional }
defaults: new { controller = "BusquedaInicial", action = "Index", id = UrlParameter.Optional }
);
}
}
}
And in the area where I am working, (well Root) I have the following:
using System.Web.Mvc;
namespace XXX.Inv.Odin.Web.Areas.BienRaiz
{
public class BienRaizAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "BienRaiz";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"BienRaiz_default",
"BienRaiz/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
}
}
Here is a picture of how the project is outlined in the project explorer:
Does anyone have an idea that I'm doing wrong?