Razor Tutoriallogin
Razor Tutorial
author:php.cn  update time:2022-04-11 14:21:21

MVC folder


ASP.NET MVC - Application Folder


To learn ASP.NET MVC, we will build an Internet application.

Part 2: Explore the Application Folder.


MVC Folder

The folder contents of a typical ASP.NET MVC web application look like this:

39.jpg

Standardized naming reduces the amount of code and helps developers understand MVC projects. The folder names of all MVC applications are the same. 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.

Here is a brief overview of the contents of each folder:


App_Data Folder

App_Data Folder is used to store applications data.

We will cover adding a SQL database to the App_Data folder later in this tutorial.


Content Folder

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.

pic_mvc_content.jpg

We will edit this stylesheet file (Site.css) in the next chapter of this tutorial.


Controllers folder

The Controllers folder contains the controller classes responsible for handling user input and the corresponding.

MVC requires that the names of all controller files end with "Controller".

Visual Web Developer has created a Home controller (for Home page and About page) and an Account controller (for Login page):

pic_mvc_controllers.jpg

We will create more controllers in later chapters of this tutorial.


Models Folder

The Models folder contains classes that represent the application models. Models control and manipulate an application's data.

We will create models (classes) in later chapters of this tutorial.


Views Folder

The Views folder is used to store HTML files related to the display of the application (the user interface).

The Views folder contains a folder corresponding to 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.

pic_mvc_views.jpg

#We will edit these layout files in the next chapter of this tutorial.


Scripts Folder

The Scripts folder stores the application’s JavaScript files.

By default, Visual Web Developer stores standard MVC, Ajax, and jQuery files in this folder:

pic_mvc_scripts.jpg

##Comments: The file named "modernizr" is the JavaScript file used to support HTML5 and CSS3 in the application.