My company is trying to setup some guidance on which technology to use for building applications. In doing my research I am getting confused.
It seems there are 3 ASP.NET technologies.
MVC is fairly clear to me as it has been around for a long time.
But I am getting confused between Razor and Razor pages. I can find lots of info on Razor Pages, but limited stuff that will compare them.
We are looking to target ASP.Net Core. So my questions are:
- [Instructor] Razor Pages is a first-class web development framework that sits on top of the lightweight cross-platform and super fast ASP.NET Core runtime. Not only that, Microsoft is now recommending Razor Pages as the preferred way to build applications on the ASP.NET Core runtime.
From the docs, "Razor Pages can make coding page-focused scenarios easier and more productive than using controllers and views." If your ASP.NET MVC app makes heavy use of views, you may want to consider migrating from actions and views to Razor Pages.
razor helps you embed serverside code like C# code into web pages. cshtml is just a file extension. razor view engine is used to convert razor pages(. cshtml) to html.
Advantages of Razor Pages:Simple context of structure and has no controllers. Flexibility to fit any application you want to build. It has specific codes behind individual pages and is more organized. Build web apps in less time just like you did in ASP.NET Webforms.
Razor is a templating syntax that was introduced in 2010 as part of the ASP.NET Web Pages framework. It was also adopted as a view engine in ASP.NET MVC 3 at the same time.
Razor Pages is a page-based web development framework that leverage the Razor templating syntax and sits on top of the ASP.NET Core MVC framework. It is the recommended framework for building page-focused server-side web applications in .NET Core. In other words, Microsoft are recommending that you do not use MVC for server-side HTML generation when you move the ASP.NET Core.
So to directly answer your questions:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With