ASP.NET Project Structure
A scalable and maintainable folder structure for ASP.NET applications
File Structure
- MyWebApp
- Program.cs
- Startup.cs
- MyWebApp.csproj
- Controllers
- HomeController.cs
- Models
- ErrorViewModel.cs
- Views
- Home
- Shared
- wwwroot
- css
- js
- lib
- MyWebApp.sln
- README.md
Directory Structure Explanation
MyWebApp/
The main web application project containing all ASP.NET Core components.
Program.cs
The entry point of the ASP.NET Core application containing the Main method and host configuration.
Startup.cs
Configures services and the application's request pipeline (in older .NET versions).
Controllers/
Contains MVC controllers that handle HTTP requests and return responses.
Models/
Contains view models and data models used by the application.
Views/
Contains Razor view files organized by controller for rendering HTML.
wwwroot/
Contains static web assets like CSS, JavaScript, and images served directly to clients.