Search code examples
asp.netrazorasp.net-webpagesasp.net-core

Port ASP.NET 4 Razor "extensionless URLs" site to ASP.NET 5


Since ASP.NET 5 changed the whole architecture around handlers, bootstrapping, etc. I am now stumped as to how to port a site using ASP.NET 4 and "extensionless URLs", "ASP.NET Web Pages" technique to ASP.NET

Before, you would have a few different settings in `web.config to implement that,

  1. System.Web.WebPages.Razor.RazorBuildProvider as a build provider for building the .cshtml pages
  2. System.Web.Routing.UrlRoutingModule as a module
  3. <add key="webpages:Version" value="3.0" /> <add key="webpages:Enabled" value="true" /> to activate the whole contraption
  4. I am unsure what else is important. Sometimes there's System.Web.WebPages.Razor.WebRazorHostFactory, System.Web.WebPages.Razor too, but web.config really became too complicated to me. I like the new way.

Anyway, I want to port this to ASP.NET 5 to make it all Linux ready (it is a chore to get pure cshtml to work on ASP.NET 4 and Mono) and easy to start up.

It would be okay if the actual implementation is different from how it was on ASP.NET 4 and if I'd have to change some things (like getting rid of _AppStart in favor of Startup.cs?), but I really don't want to use MVC for these pages.


Solution

  • I watched an ASP.NET Community Standup Meeting Google Hangouts thing on YouTube yesterday where Scott Hanselman, Jon Galloway, and Damian Edwards (Microsoft ASP.NET team members) discussed Web Pages support in ASP.NET 5. They said that it's not in the current build and won't be ready for the 1.0 release of VS 2015. However, it will probably be ready for the 1.1 release, and they mentioned you could probably find several different implementations of it on ASP.NET 5 if you look on GitHub. If I were you, I'd just use MVC until it's ready.