May 12, 2021 ASP.NET
To learn ASP.NET MVC, we'll build an Internet application.
Part 2: Explore the application folder.
A typical ASP.NET MVC web application is as follows:
|
The folder names are the same for all MVC applications. T he MVC framework is named based on the default. T he controller is written in the Controllers folder, the view is written in the Views folder, and the model is written in the Models folder. You no longer have to use folder names in your application code.
Standardized naming reduces the amount of code and facilitates developers' understanding of MVC projects.
Here is a brief overview of the contents of each folder:
App_Data folder is used to store application data.
We'll cover adding SQL databases to the folder later in App_Data tutorial.
Content folders are used to hold static files, such as style sheets (CSS files), icons, and images.
Visual Web Developer automatically adds a themes folder to the Content folder. T he themes folder holds jQuery styles and pictures. In the project, you can delete this themes folder.
Visual Web Developer also adds a standard style sheet file to the project: the Site file in the content .css file. This style sheet file is the one you need to edit if you want to change the style of your application.
We'll edit this style sheet file (Site) in the next chapter .css.
The Controllers folder contains the controller classes that are responsible for handling user input and the appropriate controller.
MVC requires the name of all controller files to end with "Controller".
Visual Web Developer has created a Home controller (for Home and About pages) and an Account controller (for Login pages):
We'll create more controllers later in this tutorial.
The Models folder contains classes that represent the application model. The model controls and manipulates the application's data.
We'll create a model (class) later in this tutorial.
Views folders are used to store HTML files (user interfaces) related to the display of an application.
The Views folder contains one 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 sign-in.
Home folders are used to store application pages such as home and out pages.
Shared folders are used to store views (master and layout pages) shared between controllers.
We'll edit these layout files in the next chapter of this tutorial.
The Scripts folder stores JavaScript files for your application.
By default, Visual Web Developer holds standard MVC, Ajax, and jQuery files in this folder:
Note: A file named "modernizr" is a JavaScript file that enables applications to support HTML5 and CSS3.