Deleted bin folder and also have cleaned and rebuilt multiple times. For some reason after checking all the required files where routes get configured I am running into the naming error, I changed it and manuplated it to my best extent, but I am stuck. I am trying to learn asp.net, but this error has me dumbfounded.
This is folder system, I have expanded the important ones:
Project-
Reference-
Packages-
App_Start-
-RouteConfig.cs
-WebApiConfig.cs
Areas-
-Billing
-Invoice
Content-
Controllers-
Models-
Scripts-
Views-
Global.asax
Pacages.config
Web.config
I have a registration file in each of my Areas.
Here is the registration code form one of the Areas.
using System;
using System.Web.Mvc;
namespace WORK_GODDAMN.Areas.Billing
{
public class BillingAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Billing";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Billing_default",
"Billing/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
}
}
Here is my Global.asax code
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Http;
namespace WORK_GODDAMN
{
public class Global : HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
}
Here is my routeConfig code
using System.Web.Mvc;
using System.Web.Routing;
namespace WORK_GODDAMN
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//AreaRegistration.RegisterAllAreas();
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new string[] { "Core.Controllers" }
);
}
}
}
cshtml code for the Index Page which should redirect to the predefined Areas.
<!DOCTYPE html>
<html>
@using System.Web.Optimization
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@Scripts.Render("~/Scripts/modernizr.js")
</head>
<body>
<div>
<div>
<h2>{Demo}- Pluggable Modules</h2>
</div>
<div id="nav">
@Html.ActionLink("Home","Index","Home", new {Area=""}, null) |
@Html.ActionLink("Marketing","Index","Marketing", new {Area="Marketing"}, null) |
@Html.ActionLink("BillingMain", "Index", new { Area = "Billing" })
</div>
<hr />
<div>
@RenderBody()
</div>
</div>
@Scripts.Render("~/Scripts/jquery.js")
@RenderSection("Scripts", required: false)
</body>
</html>
I am not why this confliction is happening, I have cleaned and rebuilt multiple times, I am using 2017 Mac Visual Studio so I had to configure Areas myself.