Skip to main content

Posts

Showing posts from March, 2018

All About Pages In ASP.NET Core 2.0

I hope while working on Razor pages, one thing you have noticed is @page.  Let’s say you added a new page (named Sample.cshtml) in Visual Studio Code in your existing application. Once the page is added, we will get an empty editor window on the right side pane where we are going to write code for our page. In order to make things simple, I’m adding very simple HTML code:        <h1> Welcome to my page </h1>          Now, save the application and run. Oops 404! Any idea why we end up looking at such a weird page? Well, @page is holding this magic. Basically, none of the Razor pages will be considered as pages until and unless they are decorated as @page in the very first line. But as soon as we append the @page in our newly added Sample.cshtml page, things will work as expected. Next, we will quickly look at a few of the files which are added by default under a Pages folder with some pre-...