ASP.NET Web Pages vNext or Razor Pages

4.56 (9 votes)

Now that the RTM of ASP.NET Core has shipped, the ASP.NET team are looking at the features that were left behind including SignalR and Web Pages. The ASP.NET Core road map always had those items scheduled for inclusion in the first major release after RTM, which will be ASP.NET Core 1.1. Recently, the ASP.NET Team provided an update on GitHub on the goals driving the next version of Web Pages which provides an interesting insight into the potential features of the framework.

UPDATE: It seems I may have jumped the gun. The ASP.NET team are very keen to point out that the feature I refer to below is NOT a new implementation of ASP.NET Web Pages. Web Pages still remains on the roadmap, but how this feature relates to that roadmap entry is currently unclear. I shall provide further updates as things are clarified. However, at the moment it is looking increasingly unlikely that a straight replacement for Web Pages is being planned at all.

Update 2:Web Pages has now been removed from the current Roadmap so it looks like Web Pages is no longer going to be included in ASP.NET Core.

Update 3: Razor Pages has been released in Preview form. It is not Web Pages, but if you liked Web Pages, Razor Pages is well worth looking at.

The first thing to note is that the version of Web Pages that will be supported in ASP.NET Core has yet to be officially named. The feature is referred to as "Razor Pages" throughout the GitHub issue (now changed to MVC Pages), but the issue itself is currently titled "MVC Pages" (now MVC View Pages). In the .NET Core roadmap, it is referred to as (yuk!) View Pages. The term "Web Pages" is so generic that it makes searching for relevant information difficult. Calling it something different will help with this and makes a pretty clean break from the existing Web Pages framework, with which it shares little more than a passing resemblance. The templating syntax will still be Razor, and the files will still be cshtml files, but there will also be significant differences. This is a totally new framework, not a version increment of the existing Web Pages framework. My preference in terms of naming is Razor Pages, as that is likely to create the least confusion.

Built on ASP.NET Core, Razor Pages will sit on top of .NET Core MVC. There are two benefits to this: first, you will be able to build Razor Pages sites that can be deployed on Unix as well as Windows servers, taking advantage of the fact that .NET Core is designed to enable cross-platform development. This provides users with much greater freedom in the hosting packages that they can opt for. The second benefit is that many of MVC's features can be surfaced in Razor Pages.

MVC Features

So what are the key MVC features that the ASP.NET team are considering exposing via Razor Pages? Here's a quick run-down of some of them and a look at how they can improve the development experience.

Model Binding

Model Binding is already available in both MVC and Web Forms. Anyone who has done a fair amount of Web Pages development involving forms will be more than familiar with the amount of code you have to write to assign values from the various Request collections (Forms, QueryString etc.) to variables to pass as parameter values for database operations or other processing. A large CRUD site can involve a huge amount of this type of code. It's boring and repetitive. The model binding system does all of this for you.

The current proposal is to add a feature called Page Actions that works in a similar way to controller actions in MVC. These are methods that take parameters which are hydrated by the model binding feature. It will work something like this:

@class {
    public IActionResult OnPost(Product product)
        // do something with product
        return View();

This method will execute if the page is requested using the Http POST verb, which is the equivalent to checking the condition if(IsPost) at the moment. The product variable will be auto-magically populated with values from Request.Form. The return View() statement will result in the page content being rendered to the browser.


An ActionResult is the return type of a Page Action. MVC features a wide variety of different ActionResult types, including a FileResult for returning files to the browser, JsonResult, ContentResult (for returning strings), RedirectResult (which replaces Response.Redirect) and so on. They make life easier in that they set the right ContentType for the browser (except for the FileResult, which you have to specify).


TagHelpers are reusable components for generating HTML. They use an HTML-like syntax. There are already a number of built-in TagHelpers for a variety of form fields as well as for generating links, managing caching and so on. In addition, it is easy to create your own.

Strongly Typed Html Helpers

In the current version of Web Pages, you can use Html Helpers to render form fields:


The MVC framework includes strongly-typed versions of these that know about the "model" for the current View. It will be possible to declare the model type for a Razor Page via an @model directive, and then make use of the strongly typed helpers e.g.:

@model Person
@Html.TextBoxFor(model => model.FirstName)

The key benefit of this approach is that it provides type safety, with compile-time checking of the helper. In the first example, the code relies on a string. It will fail silently if you attempt to reference the content of the textbox using a different value to the one specified in the helper e.g. Request["ForeName"]. In the strongly-typed example, if you try to use a property name that doesn't exist in the Person class, the code won't compile. Not only that, but strongly typed helpers enable better Intellisense support. When you combine that with Model Binding, you save quite a bit of time and reduce the potential for bugs.

MVC-Light or Razor Web Forms?

One of the more interesting discussion points posted by the ASP.NET team concerns the idea of adding a "code-behind" feature. On further questioning it seems that this is being considered to facilitate code separation and unit testing. These are two of the key drivers behind the introduction of the MVC framework some 8 years ago, so now it appears that the ASP.NET team are contemplating adding an "MVC-Light" option, which removes the ceremony around having controllers which inherit from the Controller class, and having View files in specific locations within a Views folder. The controller will actually be the code-behind, with a one-to-one relationship between controller and view, which is very much like the Web Forms development model based on the Page Controller pattern. Leaving aside the absence of the event driven aspect of Web Forms, the proposed approach will potentially feel quite familiar to Web Forms developers who have yet to embrace MVC - especially when one includes the use of TagHelpers which bare a passing resemblance to server controls. I dare say it will also provoke quite a bit of debate in both directions.

I was originally a little confused about the purpose of this suggestion, but now that Ryan Nowak and Damian Edwards have provided a bit more explanation, I'm quite intrigued to see how it will work out - if it ever passes the "idea" phase.

Data Access

WebMatrix.Data was introduced as the main means for accessing databases in the Web Pages framework. Nothing has been mentioned officially in respect of data access strategies for a Razor Pages framework, but I would like to see WebMatrix.Data ported over to .NET Core to enable its use with Razor Pages. This wouldn't preclude the use of other data access methods such as Entity Framework of course. If WebMatrix.Data is reused, it would be nice to have async support and some methods that accept generic type arguments to return strongly typed data, as well as dynamic return types e.g.:

var data = db.QueryAsync<List<Product>>("select * from Products");


var product = db.QuerySingleAsync<Product>("select * from product where id = @0", id);


There is still a way to go before the next version of Web Pages is introduced, and no doubt things will be added and removed from the list of ideas currently presented. If you want to keep up with development, follow the issue at GitHub.

Date Posted:
Last Updated:
Posted by:
Total Views to date: 6138


- Don

Thanks Mike! Wonder if the MVC Lite is the Controllerless Views approach referred to on the Web Dev and Tools Blog?

- Mike


Yes, it is. I meant to include that term in the article. I will update it a bit later accordingly.

- infocyde

Curious to see if a new release of webmatrix will happen or if that is dead in the water.

- Mike


There's no doubt about that at all. WebMatrix has been dead in the water for quite some time. The official position is that it is no longer being actively developed. The choices for developing Razor Pages will be Visual Studio and Visual Studio Code.

- Satyabrata

Thanks for sharing

- Curt Smith

I am only slightly disappointed to hear that WebMatrix is officially dead, because I suspected this was unfortunately the case. I thought it was a great little program and wish it had continued. However, Visual Studio Code seems to more than make up the difference for me.

- cyrus

I think adding these features to webpages make it complicated. msft forget webpages goal so we move to php and forget all msft technologies too.

- jared

hi mike, just for clarification, is viewpages something different from webpages? is webpages still on the .net core roadmap and will be simple as it is? thanx

- Mike


I can' provide any clarification on that. I asked the same question on GitHub about a month ago and no one on the team has replied yet.

It wouldn't surprise me to learn that no final decisions have been made.

- yousaid

Increasingly, learning a Microsoft tool is no longer worth the return on investment. Too many tools introduced and killed once developers become familiar with it. WebMatrix is a good example of this stop and go from MS.

- dave

Do SimplemembershipProvider in viewpages is supported?

- Mike


Nope, and as far as I can tell, there are no plans to introduce an equivalent helper for membership

- cyrus

I've got some news. As Damian stated in this link:

“We already have a product called "ASP.NET Web Pages". This feature is not a new version of this product.“

- Mark

Although "Web Pages" was removed from the roadmap, has it just been renamed to "Razor Pages"?

- Mike


Web Pages has not been renamed to Razor Pages. Razor Pages is something different altogether. At the moment, it seems that Web Pages has been abandoned in favour of the new Razor Pages framework.

Recent Comments

Thomas 05/03/2018 00:59
In response to I'm Not Writing A Book On Razor Pages
There's a typo on this page: = true)] should be [BindProperty(SupportsGet = true)]...

Rolf Herbert 04/03/2018 19:25
In response to I'm Not Writing A Book On Razor Pages
So is MS deprecating razor Web Pages..? Is it dead..? I wish they would stop killing things so its...

Borut 17/02/2018 12:59
In response to I'm Not Writing A Book On Razor Pages
Mike, is it possible that Web Pages and Razor Pages "live" together in one web application? I a I...

hrboyce 09/02/2018 04:44
In response to I'm Not Writing A Book On Razor Pages
Mike, First thanks for doing this but I have to ask, any chance you would consider converting one of...

aziz sallam 07/02/2018 10:18
In response to I'm Not Writing A Book On Razor Pages
u are a great man...

Satyabrata Mohapatra 31/01/2018 11:36
In response to I'm Not Writing A Book On Razor Pages
This is a great news!!!! Thanks...

tangdf 30/01/2018 07:25
In response to I'm Not Writing A Book On Razor Pages
=> { o.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute()); }); The extension method does...

Obinna Okafor 30/01/2018 04:02
In response to I'm Not Writing A Book On Razor Pages
Thank you very much. I would like to see a project built from scratch using Razor Pages. And it show...

rachida Dukes 31/10/2017 13:52
In response to Customising Identity in Razor Pages
Thanks again for this wonderful tutorial. I followed all the steps in this section called: Adding...

Rachida 31/10/2017 12:06
In response to Customising Identity in Razor Pages
Thanks very much for this wonderful tutorial, it helped a lot....