Learn how to create razor page application 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.
Open Visual Studio 2017, Select File => New => Project
Select "Web Application" then click "OK"
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.
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.