With this tutorial you can create a razor pages web app.
Prerequisites: Visual Studio 2019 Community with dotnet core 2.1 or later
You can download the project code here
- Open Visual Studio 2019 and in “File” menu, select “New > Project”
- Select “Create a new ASP.NET Core Web Application” and select “Next”
- In project configuration set project name “MoviesManager”
- click on “create” button
- Select “ASP.NET Core 2.1” in the dropdown, then “Web Application”
- click on “create” button
To run this first base application:
Press Ctrol+F5
First time, you will see this alert:
Press “Yes” to confirm the IIS SSL certificate to trust the application
Then you recieve an alert like this:
Press “Yes” to install the certificate
IIS runs the app and open it in your default browser (you can receive a security alert in your browser)
Project Files
The project is composed by this files and folders:
“Pages” folder:
Contains the razor pages. Each razor page contain 2 files, .cshtml file with HTML and razor/c# syntax and .cshtml.cs file with code that handles page events
Some files have names that begin with an underscore.
For example, _Layout.cshtml file configures UI elements common to all pages (header and footer areas for example). This files with underscore are common files within the project under “Shared” folder
“wwwroot” folder:
Contains static files, such as HTML files, JavaScript files, and CSS files.
“appSettings.json” file:
Contains configuration data (connection strings, etc)
“Program.cs” file:
Application entry point.
“Startup.cs” file:
Contains code that configures app behavior (any type of behavior to need be initialized, such us, logs, security, etc)
“Dockerfile” file:
Contains Docker instructions to deploy.
You can download the project code here
GOTO next step: “.NET Core Tutorials – Razor Pages – Adding a model”
This content is property of Matias Creimerman.
Any misuse of this material will be punishable.
This work is licensed under a
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
About the author:
Matías Creimerman
Matias Creimerman