What are areas in ASP.NET MVC?
Quick Answer
An area is a way to partition a large MVC app into functional modules, each with its own Controllers, Views and Models folders — e.g. an Admin area separate from the public site. Controllers are marked [Area("Admin")] and URLs get an area segment (/Admin/Users/Edit/5).
Areas let me split a big MVC app into modules, each with its own controllers, views and models folder — the classic example is an Admin area kept separate from the public-facing site. The controller gets an [Area("Admin")] attribute, the routing adds an area segment so URLs look like /Admin/Users/Edit/5, and links use asp-area to target or escape an area. It's an organisational tool — for genuinely independent modules I might reach for separate projects instead.
- Folder structure:
/Areas/Admin/Controllers,/Areas/Admin/Views. - Register the area route:
app.MapAreaControllerRoute(...)or the default{area:exists}/{controller}/{action}. - Link with
asp-area:<a asp-area="Admin" asp-controller="Users" asp-action="Index">. Passasp-area=""to link back to the root. - Good for: admin back-ends, tenant modules, keeping a big app organised. For truly independent modules, separate projects or a modular monolith may be better.