How to Run HTML and Razor Pages in Asp.net Core Empty Project in Visual Studio 2022

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome to my channel this is part three of our asp.net core tutorial Series in this part we will learn about adding some folders and pages into rsp.net empty application so we have created this test empty application in our first tutorial so if I run this so you can see it print this hello world now if I close this down and now if I come here I can show you that in this program.cs file we have the soil award which is shown in the browser so today we will edit add some pages and we will show them so first we will add the www root folder which is fast static pages so I will come to this add add new folder and I'll name this www root and now we will add an HTML page in this root folder and we will show them now I'll right click on this and add and I'll use here item and I'll name this index dot HTML so the name of this uh default page would be index or dot HTML or default dot HTML so I will add this now I have added the page here you can see it here now I'll add in each one tag here so H1 and I'll add welcome to hp.net core and I'll control acid now if I run this uh application right now you will see that this message will not be shown and the default hello word message will be shown to show this page in the browser we need some settings and this program.cs file so if I come here into this program.cs file and remove this line now here I will add align app dot use static files because HTML CSS and JavaScript we use them in the static folder www root which is a par static files so we will use in our program.cs file app dot use static files now if I run this right now now the application is running but it is not showing uh anything it is not firing up the browser so we will add another line as well so for that I will come here and I will use Here app dot use default default files and now I'll put semicolon now if I run this right now so it will show this index.html page and it will show Welcome to sp.net core which we have shown here in this H1 tag now if I show you this application which I have created and if I run this now you can see we have this index.c HTML file which is eraser page and if I run this application you will see that this page is running now you can see that this page is running which has this uh welcome message now how can we achieve this so I will go toward our test project and here I'll create a new folder add folder and I'll name this page and now I'll okay this and now here we will add in a new item and it will be a Razer page error you can go to new item and I you can name this index on dot CS HTML and now if I hit add so it will add the page right here you can see here the page is added and we have this where we will use the title of the page so I'll use view data and here inside this I will use title equal to and I'll use this first page and put semicolon and now outside this curly braces we will create a Dev take div and here we will show something and I'll use H1 and I'll use here this is a razor page and our control is it so now to run in asp.net um core razor page we have to add two things into this uh program.cs file first we will come here at the top and here we will use for Builder dot Services dot add razor Pages you can add MVC you can add MVC code but right now we will add razor pages and now I'll put semicolon here and down here we will write app dot map eraser pages and now if I put semicolon and now if I control sit and now we run this application here you can see this is eraser page is shown here so I think that's all for today I hope you like the video if you like the video please like subscribe and comment thank you
Info
Channel: Programming Guru
Views: 4,441
Rating: undefined out of 5
Keywords: programming, asp.net, c#, asp.net core, asp.net core razor pages, asp.net core html pages, how to add and run html and razor pages in asp.net core, run html in asp.net core project, add html pages in asp.net core empty project, add razor pages in asp.net core empty project, run razor pages in asp.net core, run html pages in asp.net core, asp.net core for beginners, .net core, .net core tutorial, dot net, how to create asp.net web application in visual studio 2022, visual studio 2022
Id: Vzilt47V5GY
Channel Id: undefined
Length: 5min 2sec (302 seconds)
Published: Mon Mar 13 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.