John Schultz John Schultz - 1 year ago 77
ASP.NET (C#) Question

MVC5 Area not behaving properly

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:

gives the error that the resource cannot be found (basically a 404).

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
return "Setup";

public override void RegisterArea(AreaRegistrationContext context)
name: "Setup_default",
url: "Setup/{controller}/{action}/{id}",
defaults: new { action = "Index", controller = "Setup", id = UrlParameter.Optional },
namespaces: new[] { "BlocqueStore_Web.Areas.Setup.Controllers" }

Answer Source

Since you have an Area named Setup with the above route configuration, opening http://localhost:45970/Setup/Start will execute StartController under Setup Area. You got 404 error because you don't have StartController under Setup Area, but you can open http://localhost:45970/Setup/Setup/Start successfully because you have SetupController and Start action method under Setup Area.

Based on your comment, you want the following url patterns


You can accomplish that without using any Area. You only need AdminController and SetupController using the default route.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download