Razor Page in Asp.net Core, Free Asp.net Core Tutorial for Beginners, Asp.net Core MVC

Razor Pages Application Tutorial

Learn how to create razor page application in asp.net core.

Learn Razor Pages in Asp.net Core

In this tutorial we will learn how to create a simple Asp.net Core Web Application step by step to understand over all structure of asp.net core project folders, pages, wwwroot, code behind etc.

Setp 1:
Open Visual Studio 2017, Select File => New => Project

Create Razor Pages Application

Step 2:
Select "Web Application" then click "OK"

create asp.net core project
Step 3:

As we can see the following Asp.Net Core default stricture created by visual studio. Now let’s understand each folder, files and how they work.

Razor Page Application Structure

Razor Page Application Structure

Now if you notice there is something called “Pages” folder which contain many razor pages inside, razor pages are just like web form in earlier version, so in this new pages we have chtml.cs , means code behind file like we used to have in aspx.cs

The thought behind this razor page was to keep all functionalities keep in one place for that particular page, so for small project or website this may be good, but I personally don’t like the idea, because for many reason, one strong reason is that this approach may make “re-usability of code” more difficult, and writing all in one place may look dirty.

While creating a page under pages folder, it gives an option to select a model and one of CRUD operation.

But there was a plan for this type page design, razor page is lightweight, very flexible & cross platform compatible.

In next tutorial we talk about handler methods and lifecycle of razor page request in Asp.Net Core application.

Here are the few things like default files, folders you may find new in asp.net development

so let’s learn them one by one.

Learn Razor Pages
ASP.NET MVC Interview Questions Answers
Hire Asp.net Developer
Asp.Net Core C# Examples | Join Asp.Net MVC Course