Opinion Time: Should Razor Pages Be the Default for ASP.NET Core Apps?

A few days ago I published the latest ASP.NET Core Demystified post which was all about Razor Pages and demonstrated how to build an app using them. In the process of writing that post, I realized that I had a deep, pervasive problem with one of Microsoft's decisions regarding Razor Pages, and I need your help to convince me either that I'm right, I'm wrong, or I'm making a mountain out of a molehill (or even all three).

Sponsored by #native_company#
#native_desc# #native_cta#

Let's get right to it. Here's the problem I have with Microsoft's treatment of "standard" ASP.NET MVC apps vs Razor Pages apps, summed up in one image:

A screenshot of the Visual Studio project type window, with the option for "Web Application" selected

Microsoft has made Razor Pages the default web application type for ASP.NET Core.

I'm a big believer in the power of defaults. Given no other information, people will most likely keep the default selections in any given situation unless pressured (or knowledgeable enough) to do otherwise. Defaults are power, and should be selected carefully. Microsoft knows this, and has clearly selected Razor Pages to be the default.

But why would they do this? Why should Razor Pages be the default? Here's the basic logic (as I see it) from Microsoft's point-of-view:

  1. Razor Pages are quick to develop. It's super easy to get trivial apps off the ground and working compared to standard ASP.NET MVC.
  2. Razor Pages apps automatically includes some benefits (namely Anti-Forgery Tokens) that are not included by default in standard ASP.NET MVC.
  3. Razor Pages keep related information in close proximity (e.g. the data for a form, the actions of that form, etc.)

And yet... I have issues with Microsoft doing this.

First of all, it's really early in the timeline of Razor Pages for it to be the default over standard MVC. It's barely been released for general use (RTM, "released to manufacturing") for a month. Obviously Microsoft thinks it is good enough to make the default, but will everyone else have the same opinion?

Second, and I freely admit this is probably a significant contributor to my hesitation to adopt Razor Pages, but I loathe WebForms. I wish it was alive so I could drag it into the street and shoot it. It's so bad, so wrong, so contrary to the way the Web works. Yet here is it's presumptive successor, a technology which marries the best of WebForms (if there is such a thing) and MVC into a tech stack which makes it easy to develop simple CRUD applications.

I can't quite put my finger on exactly why I feel this way, but I don't think Razor Pages should be the default. I feel like standard MVC apps will better serve a majority of development needs, and as such should be the default, because merely being the default encourages developers to learn it. But who cares what I think. I want to know what you think.

So, let's make a mountain out of this molehill. Tell me why or why not Razor Pages should be the default selection for ASP.NET Web Apps.

The Opinion Time! Megaphone

Alternately, tell me why I'm an idiot for obsessing over this very minor detail and assuming that it means the worst. Bring it on!

Happy Coding!

Matthew Jones

Matthew Jones

I'm a parent, a husband, a geek, a web developer, and a speaker, in roughly that order.

Read More
Opinion Time: Should Razor Pages Be the Default for ASP.NET Core Apps?
Share this