What folders should be included in an ASP.NET MVC web application? It will be introduced in this section.
To learn ASP.NET MVC, we will build an Internet application.
Part 2: Explore the application folder.
The folder contents of a typical ASP.NET MVC web application look like this:
Application information Properties References application folder App_Data folder Content folder Controllers folder Models folder Scripts folder Views folderConfiguration file Global.asax packages.config Web.config |
The folder name is the same for all MVC applications. The MVC framework is based on default naming. Controllers are written in the Controllers folder, views are written in the Views folder, and models are written in the Models folder. You don't have to use the folder name in your application code.
Standardized naming reduces the amount of code and facilitates developers' understanding of MVC projects.
Below is a brief overview of the contents of each folder:
The App_Data folder is used to store application data.
We will cover adding the SQL database to the App_Data folder later in this tutorial.
The Content folder is used to store static files, such as style sheets (CSS files), icons, and images.
Visual Web Developer will automatically add a themes folder to the Content folder. The themes folder stores jQuery styles and images. In your project, you can delete this themes folder.
Visual Web Developer will also add a standard style sheet file to the project: the Site.css file in the content folder. This style sheet file is the file that you edit when you want to change the style of your application.
We will edit this stylesheet file (Site.css) in the next chapter of this tutorial.
The Controllers folder contains the controller classes responsible for handling user input and the corresponding ones.
MVC requires that all controller file names end with "Controller".
Visual Web Developer has created a Home controller (for the Home page and About page) and an Account controller (for the Login page):
We will create more controllers in later chapters of this tutorial.
The Models folder contains classes that represent the application's models. Models control and manipulate an application's data.
We will create models (classes) later in this tutorial.
The Views folder is used to store HTML files related to the display of the application (user interface).
The Views folder contains a folder for each controller.
In the Views folder, Visual Web Developer has created an Account folder, a Home folder, and a Shared folder.
The Account folder contains pages for user account registration and login.
The Home folder is used to store application pages such as home page and about page.
The Shared folder is used to store views (master pages and layout pages) shared between controllers.
We will edit these layout files in the next chapter of this tutorial.
The Scripts folder stores the application's JavaScript files.
By default, Visual Web Developer places standard MVC, Ajax, and jQuery files in this folder:
Note: The file named "modernizr" is the JavaScript file used to make the application support HTML5 and CSS3.