locked
Razor Pages with MVC RRS feed

  • Question

  • User-305496339 posted

    Hi Friends,

    I was wondering is it a best practice to use Razor Pages with .Net Core MVC? If so how should I architect my application? Thanks !!!!

    Wednesday, January 6, 2021 7:37 PM

Answers

  • User-474980206 posted

    while you can use both, typically you'd pick one or the other. If you like the MVC pattern, use MVC otherwise use razor pages.

    MVC/Razor Views or Razor pages are just the UI layer. You should architect you app along standard practices, using layers, tiers, etc.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 6, 2021 8:31 PM
  • User-1545767719 posted

    I cannot tell the "best" for you as I do not know your knowledge, preference, circumstance and other reasons to select the MVC or Razor Page.

    So you will have to decide which way to go considering pros and cons of MVC and Razor Page against your knowledge, preference, circumstance and other reasons. Although Google will provide you with a lot of hints to help your decision, one thing I suggest you to consider is the image shown in the following article:

    ASP.NET Razor Pages vs MVC: How Do Razor Pages Fit in Your Toolbox?

    I think the image shown in the above article is self-explanatory to know the pros and cons. If you develop a new project and its content can easily be structured on page basis rather than the MVC structure, probably the choice will be the Razor Page.

    As a matter of fact, in the MVC application with ASP.NET Core Identity generated by the Visual Studio 2019, all the pages used for the authentication such as the Login and Resister are supplied as the Razor Class Library (RCL).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 7, 2021 2:49 AM

All replies

  • User-474980206 posted

    while you can use both, typically you'd pick one or the other. If you like the MVC pattern, use MVC otherwise use razor pages.

    MVC/Razor Views or Razor pages are just the UI layer. You should architect you app along standard practices, using layers, tiers, etc.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 6, 2021 8:31 PM
  • User-1545767719 posted

    I cannot tell the "best" for you as I do not know your knowledge, preference, circumstance and other reasons to select the MVC or Razor Page.

    So you will have to decide which way to go considering pros and cons of MVC and Razor Page against your knowledge, preference, circumstance and other reasons. Although Google will provide you with a lot of hints to help your decision, one thing I suggest you to consider is the image shown in the following article:

    ASP.NET Razor Pages vs MVC: How Do Razor Pages Fit in Your Toolbox?

    I think the image shown in the above article is self-explanatory to know the pros and cons. If you develop a new project and its content can easily be structured on page basis rather than the MVC structure, probably the choice will be the Razor Page.

    As a matter of fact, in the MVC application with ASP.NET Core Identity generated by the Visual Studio 2019, all the pages used for the authentication such as the Login and Resister are supplied as the Razor Class Library (RCL).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 7, 2021 2:49 AM