ASP.NET MVC - Application folder
- Previous Page MVC Application
- Next Page MVC Layout
To learn ASP.NET MVC, we will build an Internet application.
Part 2:Understand the application folder.
MVC Folder
A typical ASP.NET MVC web application has the following folder contents:
Application information
- Properties
- References
Application folder
- App_Data folder
- Content folder
- Controllers Folder
- Models Folder
- Scripts Folder
- Views Folder
Configuration files
- Global.asax
- packages.config
- Web.config
The folder names in all MVC applications are the same. The MVC framework is based on default naming. Controllers are located in the Controllers folder, views are located in the Views folder, and models are located in the Models folder. You do not need to use folder names in the application code.
Standardized naming reduces the amount of code and is conducive to developers' understanding of MVC projects.
Below is a brief description of the contents of each folder:
App_Data folder
The App_Data folder is used to store application data.
We will add an SQL database to the App_Data folder later in this tutorial.
Content folder
The Content folder is used for static files, such as style sheets (CSS files), charts, and images.
Visual Web Developer will automatically add a file to the Content folder themes folder. This themes folder stores jQuery styles and images. In this project, you can delete this theme folder.
Visual Web Developer adds standard style sheet files to the project: files in the Content folder Site.cssThis stylesheet file is the one you need to edit when you want to change the style of the application.
We will edit this stylesheet file (Site.css) in the next chapter of this tutorial.
Controllers Folder
The Controllers folder contains controller classes responsible for handling user input and responses.
MVC requires that all controller file names end with "Controller".
Visual Web Developer has already created a Home controller (for the homepage and about page) and an Account controller (for the login page):
We will create more controllers in the later chapters of this tutorial.
Models Folder
The Models folder contains classes representing the application models. Models store and operate the data of the application.
We will create models (classes) in the later chapters of this tutorial.
Views Folder
The Views folder contains HTML files related to the display of the application (user interface).
The Views folder contains a folder for each controller.
Visual Web Developer has created an Account folder, a Home folder, and a Shared folder (within the Views folder).
The Account folder contains pages for registering and logging in user accounts.
The Home folder is used to store application pages such as the homepage and about page.
The Shared folder is used to store shared views (template pages and layout pages) between controllers.
We will edit these layout files in the next chapter of this tutorial.
Scripts Folder
The Scripts folder stores JavaScript files for the application.
By default, Visual Web Developer places standard MVC, Ajax, and jQuery files in this folder:
Note:The file "modernizr" is a JavaScript file used to support HTML5 and CSS3 in applications.
- Previous Page MVC Application
- Next Page MVC Layout