This post is directly related to: MVC5 Area not working
That post fixed the index.cshtml issue, however it did not resolve each view for that controller. For example:
http://localhost:45970/Setup/Start
gives the error that the resource cannot be found (basically a 404).
However http://localhost:45970/Setup/Setup/Start
brings up the correct page.
So what needs to be reconfigured so that ALL views for that controller in the Setup Area will open properly?
Edit 1
Code from SetupAreaRegistration.cs
using System.Web.Mvc;
namespace BlocqueStore_Web.Areas.Setup
{
public class SetupAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Setup";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
name: "Setup_default",
url: "Setup/{controller}/{action}/{id}",
defaults: new { action = "Index", controller = "Setup", id = UrlParameter.Optional },
namespaces: new[] { "BlocqueStore_Web.Areas.Setup.Controllers" }
);
}
}
}
Since you have an Area named
Setup
with the above route configuration, openinghttp://localhost:45970/Setup/Start
will executeStartController
underSetup
Area. You got 404 error because you don't haveStartController
underSetup
Area, but you can openhttp://localhost:45970/Setup/Setup/Start
successfully because you haveSetupController
andStart
action method underSetup
Area.Based on your comment, you want the following url patterns
You can accomplish that without using any Area. You only need
AdminController
andSetupController
using the default route.