Project Structure in ASP.NET MVC
A default ASP.NET MVC project (created via File > New Project > ASP.NET Web Application) scaffolds a predictable folder layout: /Controllers, /Models, /Views, /Scripts, /Content, and /App_Start, plus a Global.asax entry point. This convention-over-configuration approach means the framework can locate controllers, views, and startup configuration automatically as long as you follow the naming and folder conventions, minimizing the boilerplate wiring you'd otherwise need.
Cricket analogy: A default MVC project's folder layout is like a cricket academy's standard facility blueprint - nets, pitch, and pavilion always in predictable places - so any coach joining knows exactly where to find equipment without a tour.
The Controllers, Models, and Views Folders
The /Controllers folder holds C# classes whose names end in 'Controller' (e.g., HomeController.cs), and MVC's controller factory discovers them by convention without any manual registration. /Models holds domain and view-model classes, and /Views contains one subfolder per controller (e.g., /Views/Home/) plus a /Views/Shared folder for cross-cutting templates like _Layout.cshtml, Error.cshtml, and _ViewStart.cshtml.
Cricket analogy: MVC discovering HomeController.cs by its name ending in 'Controller' is like a scorer automatically filing a player's stats under their registered team name, no manual sorting required.
App_Start: Bootstrapping the Application
The /App_Start folder centralizes startup configuration in dedicated static classes: RouteConfig.cs registers URL routing patterns, BundleConfig.cs configures CSS/JS bundling and minification, FilterConfig.cs registers global action filters like HandleErrorAttribute, and these are all invoked from Application_Start() in Global.asax.cs when the app first boots.
Cricket analogy: Application_Start() invoking RouteConfig and FilterConfig is like a team's pre-match routine - warm-up, team-sheet submission, pitch inspection - all run in sequence before the umpire calls play.
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}Static Content and Areas
Static assets like CSS, JavaScript, and images live in /Content and /Scripts (or wwwroot in newer templates), served directly by IIS/Kestrel without going through the MVC pipeline, while larger applications use Areas - self-contained mini-MVC structures under /Areas/{AreaName}/ with their own Controllers, Models, and Views folders - to organize distinct functional modules like Admin or Blog.
Cricket analogy: Static images served directly from /Content bypassing MVC's pipeline is like ground staff replacing sightscreens without needing umpire approval - a background task independent of the actual match logic.
Areas require their own AreaRegistration class (e.g., AdminAreaRegistration.cs) registered via AreaRegistration.RegisterAllAreas() in Global.asax, and their routes must include an {area} route value to avoid colliding with the default route.
- Default project structure: /Controllers, /Models, /Views, /Scripts, /Content, /App_Start.
- Controllers are discovered by naming convention (class names ending in 'Controller').
- /Views/Shared holds cross-cutting templates like _Layout.cshtml and Error.cshtml.
- App_Start classes (RouteConfig, BundleConfig, FilterConfig) centralize startup configuration.
- Application_Start() in Global.asax.cs invokes all App_Start registration methods.
- Static assets in /Content and /Scripts bypass the MVC pipeline entirely.
- Areas let large applications organize self-contained modules with their own MVC folder structure.
Practice what you learned
1. How does MVC discover controller classes by default?
2. Where do cross-cutting templates like _Layout.cshtml typically live?
3. Which file registers URL routing patterns in a default MVC project?
4. What is the purpose of the /Areas folder?
5. What method in Global.asax.cs kicks off all App_Start registrations?
Was this page helpful?
You May Also Like
What Is ASP.NET MVC?
An introduction to ASP.NET MVC, Microsoft's web framework built on the Model-View-Controller pattern for building dynamic, testable web applications on .NET.
The MVC Architecture Pattern
A deep dive into how Model, View, and Controller responsibilities are divided in ASP.NET MVC, and why that separation matters for testability and maintainability.
Installing and Setting Up MVC
A practical walkthrough of setting up your development environment and creating your first ASP.NET MVC project using Visual Studio and the .NET tooling.
Related Reading
Related Study Notes in Microsoft Technologies
Browse all study notesWindows 10 / UWP Development Study Notes
.NET · 30 topics
Microsoft TechnologiesWindows Batch Scripting Study Notes
Batch · 30 topics
Microsoft TechnologiesMFC (Microsoft Foundation Classes) Study Notes
C++ · 30 topics
Microsoft TechnologiesSilverlight Study Notes
.NET · 30 topics
Microsoft TechnologiesXAML Study Notes
.NET · 30 topics
Microsoft TechnologiesWPF (Windows Presentation Foundation) Study Notes
.NET · 30 topics