Razor Pages is a page-based model for building server rendered web UI. Razor pages UI are dynamically rendered on the server to generate the page's HTML and CSS in response to a browser request. The page arrives at the client ready to display. Support for Razor Pages is built on ASP.NET Core MVC.
Razor Pages benefits:
Quickly build and update UI. Code for the page is kept with the page, while keeping UI and business logic concerns separate.
Testable and scales to large apps.
Keep your ASP.NET Core pages organized in a simpler way than ASP.NET MVC:
View specific logic and view models can be kept together in their own namespace and directory.
Groups of related pages can be kept in their own namespace and directory.
ASP.NET Core MVC renders UI on the server and uses a Model-View-Controller (MVC) architectural pattern. The MVC pattern separates an app into three main groups of components: models, views, and controllers. User requests are routed to a controller. The controller is responsible for working with the model to perform user actions or retrieve results of queries. The controller chooses the view to display to the user and provides it with any model data it requires.
ASP.NET Core MVC benefits:
Based on a scalable and mature model for building large web apps.
The Model-View-Controller separation of responsibilities ensures that the business model can evolve without being tightly coupled to low-level implementation details.
ASP.NET Core Single Page Applications (SPA) with frontend JavaScript frameworks
Build client-side logic for ASP.NET Core apps using popular JavaScript frameworks, like Angular, React, and Vue. ASP.NET Core provides project templates for Angular, React, and Vue, and it can be used with other JavaScript frameworks as well.
Benefits of ASP.NET Core SPA with JavaScript Frameworks, in addition to the client rendering benefits previously listed:
The JavaScript runtime environment is already provided with the browser.
Large community and mature ecosystem.
Build client-side logic for ASP.NET Core apps using popular JS frameworks, like Angular, React, and Vue.
Downsides:
More coding languages, frameworks, and tools required.
Difficult to share code so some logic may be duplicated.
Combine multiple web UI solutions: ASP.NET Core MVC or Razor Pages plus Blazor
MVC, Razor Pages, and Blazor are part of the ASP.NET Core framework and are designed to be used together. Razor components can be integrated into Razor Pages and MVC apps. When a view or page is rendered, components can be prerendered at the same time.
Benefits for MVC or Razor Pages plus Blazor, in addition to MVC or Razor Pages benefits:
Prerendering executes Razor components on the server and renders them into a view or page, which improves the perceived load time of the app.
Razor Pages is a page-based model for building server rendered web UI. Razor pages UI are dynamically rendered on the server to generate the page's HTML and CSS in response to a browser request. The page arrives at the client ready to display. Support for Razor Pages is built on ASP.NET Core MVC.
Razor Pages benefits:
Quickly build and update UI. Code for the page is kept with the page, while keeping UI and business logic concerns separate.
Testable and scales to large apps.
Keep your ASP.NET Core pages organized in a simpler way than ASP.NET MVC:
View specific logic and view models can be kept together in their own namespace and directory.
Groups of related pages can be kept in their own namespace and directory.
ASP.NET Core MVC renders UI on the server and uses a Model-View-Controller (MVC) architectural pattern. The MVC pattern separates an app into three main groups of components: models, views, and controllers. User requests are routed to a controller. The controller is responsible for working with the model to perform user actions or retrieve results of queries. The controller chooses the view to display to the user and provides it with any model data it requires.
ASP.NET Core MVC benefits:
Based on a scalable and mature model for building large web apps.
The Model-View-Controller separation of responsibilities ensures that the business model can evolve without being tightly coupled to low-level implementation details.
ASP.NET Core Single Page Applications (SPA) with frontend JavaScript frameworks
Build client-side logic for ASP.NET Core apps using popular JavaScript frameworks, like Angular, React, and Vue. ASP.NET Core provides project templates for Angular, React, and Vue, and it can be used with other JavaScript frameworks as well.
Benefits of ASP.NET Core SPA with JavaScript Frameworks, in addition to the client rendering benefits previously listed:
The JavaScript runtime environment is already provided with the browser.
Large community and mature ecosystem.
Build client-side logic for ASP.NET Core apps using popular JS frameworks, like Angular, React, and Vue.
Downsides:
More coding languages, frameworks, and tools required.
Difficult to share code so some logic may be duplicated.
Choose a hybrid solution: ASP.NET Core MVC or Razor Pages plus Blazor
MVC, Razor Pages, and Blazor are part of the ASP.NET Core framework and are designed to be used together. Razor components can be integrated into Razor Pages and MVC apps. When a view or page is rendered, components can be prerendered at the same time.
Benefits for MVC or Razor Pages plus Blazor, in addition to MVC or Razor Pages benefits:
Prerendering executes Razor components on the server and renders them into a view or page, which improves the perceived load time of the app.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
ASP.NET Core feedback
ASP.NET Core is an open source project. Select a link to provide feedback:
Build end-to-end solutions in Microsoft Azure to create Azure Functions, implement and manage web apps, develop solutions utilizing Azure storage, and more.