May 12, 2021 ASP.NET
To learn ASP.NET MVC, we'll build an Internet application.
Part 5: Add a view to display the application.
The Views folder stores files (HTML files) related to the application display (user interface). Depending on the language content used, these files may be extensions to html, asp, aspx, cshtml, and vbhtml.
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.
The following HTML file types can be seen in the Views folder:
file type | extension name |
---|---|
Pure html | .htm or .html |
Classic ASP | .asp |
Classic ASP.NET | .aspx |
ASP.NET Razor C# | .cshtml |
ASP.NET Razor VB | .vbhtml |
The file Index.cshtml represents the Home page of the application. It is the default file (home file) for the application.
Write the following in the file:
The file, About.cshtml, represents the Out page of the application.
Write the following in the file:
Select Debug to start debugging Start Debugging (or press F5) from the Visual Web Developer menu.
Your application will look like this:
Click on the "Home" tab and the "About" tab to see how it works.
Congratulations. You have created your first MVC application.
Note: You can't click on the "Movies" tab right now. We'll add code to the "Movies" tab later in this tutorial.