Folder Structure of MVC Application
Folder Structure of MVC Application: Today we are going to show you the basic folder structure of MVC Application. For that we will use Internet Application template for more understanding.
Incoming search terms
Folder Structure of MVC Application, MVC Folder Structure, Understanding ASP.NET MVC Folder Structure, MVC Framework and Application Structure, MVC Framework – Folders, Clean Architecture in ASP.NET MVC 5, model view controller – Directory Structure for MVC, An Ideal Folder Structure for .NET MVC.
In previous articles we explained Features of MVC versions, How to Create First MVC Application, FileUpload in ASP.NET using C#, Export DataTable to Excel in ASP.NET, Calculate Distance and Time Between Two Points using Google Map API, Windows Forms Controls in WPF, Display Unicode Characters in Converting Html to Pdf, Tag Cloud in ASP.NET, Save and Retrieve Images From Database, Upload file without clicking on Button, Generate QR Code Image, Get Network and Local Printer List in ASP.NET, Custom Slider Control in WPF, Convert Comma Separated String to Table in SQL, Bind ListView in ASP.NET, Encrypt and Decrypt String in C#, Retrieve Dropped Stored Procedure, Function, Table in SQL, Minimum and Maximum Text Length Validation in ASP.NET, etc.
Folder Structure of MVC Application
Create MVC Application
If you are sound with the MVC then you know very well how to create MVC application.
We will use Internet Application template for more understanding.
Visual Studio creates the following folder structure for MVC application by default.
App_Data folder can contain application data files like .mdf files, xml files, LocalDB and other data related files. IIS will never serve files from App_Data folder.
This folder contains all the files which are needed during the application load.
By default it contains AuthConfig, BundleCongfig, FilterConfig, RouteConfig and WebApiConfig files.
For e.g., the RouteConfig file is used to route the incoming URL to the correct Controller and Action.
Content folder contains static files like css files, images and icons files.
The Site.css file inside this folder is the default styling that the application applies.
Controllers folder contains class files for the controllers. Controllers handles users’ request and returns a response. MVC requires the name of all controller files to end with “Controller”.
In our example, the Controllers folder contains two class files: AccountController and HomeController.
Models folder contains model class files. Typically model class includes public properties, which will be used by application to hold and manipulate application data.
This folder stores all the JS files in the project. By default Visual Studio adds MVC, jQuery and other standard JS libraries.
This folder stores the HTML files related to application display and user interface. Typically view file is a .cshtml file where you write html and C# or VB.NET code.
Views folder includes separate folder for each controllers. For example, all the .cshtml files, which will be rendered by HomeController will be in View > Home folder.
Shared folder under View folder contains all the views which will be shared among different controllers e.g. layout files.
Global.asax allows you to write code that runs in response to application level events, such as Application_BeginRequest, application_start, application_error, session_start, session_end etc.
Packages.config file is managed by NuGet to keep track of what packages and versions you have installed in the application.
Web.config file contains application level configurations.