The foundation: what the official documentation explains
MVC Areas add an area value to controller routing. Controllers declare their area with an attribute, and area routes are commonly mapped before less-specific default routes. Default view discovery uses an area-oriented convention. When a project chooses a different view layout, it must explicitly identify views or customize discovery.
Implementation context: The examples use a .NET 10 MVC application organized into feature folders (Vertical Slice Architecture). Basic C# classes and async/await are assumed. Reference excerpts show selected parts of that application; separately labeled teaching adaptations explain alternatives. They are not complete standalone projects.
Choose one small feature to navigate
For a beginner, the practical benefit of a feature folder is finding related files without opening many unrelated directories. Country provides a useful example because it is a simple master-data feature. Currency adds a lookup, while Todo adds master-detail behavior. Start with Country before extrapolating from a feature that has extra business rules.
The project documentation identifies Country as the canonical simple CRUD reference. It specifically distinguishes Company as a seeded configuration feature without ordinary create and delete operations. This is why copying whichever feature name looks familiar can produce an incomplete learning example.
Selected files from the reference structure
Areas/
Admin/
MapAdminEndpoints.cs
Country/
Controllers/CountryController.cs
Cqrs/CreateCountryHandler.cs
Cqrs/CreateCountryValidator.cs
Cqrs/GetCountryListHandler.cs
Endpoints/CountryEndpoint.cs
Views/Create.cshtml
Views/Create.cshtml.js
Connect the controller to the area
The Country controller declares Admin as its area and protects its actions with an administrator role. The area attribute affects route selection. It does not create an authorization rule by itself: a folder called Admin has no inherent security. Treat route organization and access control as separate concerns.
Reference excerpt: Areas/Admin/Country/Controllers/CountryController.cs
[Area("Admin")]
[Authorize(Roles = ApplicationRoles.AdminConst)]
public class CountryController : Controller
{
public IActionResult Index()
{
return View("~/Areas/Admin/Country/Views/Index.cshtml");
}
Explain the explicit view path
The Index action returns ~/Areas/Admin/Country/Views/Index.cshtml. That explicit path matters because the project groups views underneath Country. It is different from the conventional area layout Areas/Admin/Views/Country/Index.cshtml. If you move a view into a feature directory and leave an unqualified View() call, discovery may still search the conventional locations.
For a first feature, the explicit path is easy to inspect and debug. A larger application may centralize custom view-location conventions, but that is a further design decision. Do not describe the reference folder layout as automatic framework behavior.
Register API endpoints separately
Country also has a JSON API at /api/country. Its endpoint mapper is called by the Admin mapper. The area route that serves /Admin/Country/Index does not discover this API group. If one URL works and the other fails, check the relevant registration chain rather than moving files at random.
Reference excerpt: Areas/Admin/MapAdminEndpoints.cs
public static void MapAdminEndpoints(this IEndpointRouteBuilder app)
{
app.MapTaxEndpoints();
app.MapAutoNumberSequenceEndpoints();
app.MapCountryEndpoints();
app.MapCurrencyEndpoints();
app.MapCompanyEndpoints();
app.MapRoleEndpoints();
app.MapUserEndpoints();
app.MapSerilogEndpoints();
}
The mapper includes Country and Currency alongside other Admin features. Its list is explicit and searchable. Adding a new feature folder alone does not add its mapping call. The browser also needs a navigation link if people are expected to discover the screen without typing its URL.
Keep the boundaries honest
This application retains shared entities, database infrastructure, and response helpers outside the feature folders. That does not invalidate feature-oriented organization. The feature owns its request workflow, while shared code serves several workflows. Moving every shared type into Country would create awkward dependencies for Currency, which also references country data.
VSA is a way of organizing application changes here, not an ASP.NET Core switch or a guarantee that files never depend on shared infrastructure. A practical question is whether a Country validation change can be found and understood locally. Another is whether a shared database change has clearly identifiable consumers.
Verify a moved or newly organized screen
In a disposable learning copy, trace the area attribute, route pattern, explicit view path, and collocated script URL as four separate references. A view-not-found exception points to discovery; a missing JavaScript request points to asset serving. An API 404 points to route mapping or middleware. These failures need different fixes.
Keep the spelling and casing consistent across source files and URLs. A path that happens to work on a case-insensitive local filesystem may be unreliable after deployment to another environment. Avoid interpreting a successful build as proof that every browser asset path is reachable.
Key Takeaways
- Areas are a framework feature; extra feature folders are a convention.
- Explicit view paths explain how this nonstandard layout renders.
- MVC routes, API mappings, and browser asset URLs must each be connected.
FAQ
Does placing a controller in an Admin folder protect it?
No. Declare and enforce authorization separately.
Why does the example pass a full path to View?
Its views live inside the feature folder rather than the default area view location.
Does VSA require several projects?
No. This reference organizes features within one web project and shares infrastructure where needed.