Convert ASP.Net webform to ASP.Net MVC

There are several approaches to this:

First approach

Add a MVC project to your solution where you already have your ASP.Net webforms website / web application project.

Work on your MVC project separately, code, test, run.

When you’re done, compile and copy the Views folder.

Change the output path for the assembly from the local bin directory to the bin directory of my web site. This assembly contains the Controllers and Models.

Add routing to your website.

In Global.asax:

using System.Web.Mvc;
using System.Web.Routing;


public static void RegisterGlobalFilters(GlobalFilterCollection filters)
filters.Add(new HandleErrorAttribute());

public static void RegisterRoutes(RouteCollection routes)

// your routes

In Aplication_Start:


In web.config:

<add assembly="System.Web.Abstractions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

Second approach

Create Controllers and Views folder on your website

Setup/configure the routes in the global.ascx file.

Change to an MVC project type, which is still a web application by using these in the PropertyGroup of the .csproj file


Another opinion I found on
As long as you setup the routing in web.config, setup the necessary directory structure, and add the correct routes in global.asax, you could theoretically add MVC items to any web project. So far as I know, those are the only requirements for it to work.
However, the combination of the two might be a bit confusing and difficult to maintain, long term. Maybe you could move all of the existing web forms site content into a subfolder to keep it out of the way and keep the root directory of the site clean to reduce the clutter and make things more clear.
Finally, the one recommended by Microsoft:

The Microsoft .NET 4.0 exam on Web development (70-519) has almost this exact question in the prep materials. The answer, according to Microsoft then, is:

  1.     Convert the web forms website into a web application (i.e. webapp project).
  2.     Add references to “the ASP.NET MVC 2 assemblies” in the webapp’s config file.


Questions containing convert “ to mvc” – Stack Overflow

Convert website from webforms to mvc

Setting up a minimal ASP.NET MVC project in Visual Studio

How would you sprinkle-in ASP.Net MVC into an existing Web Site Project? [closed]


One response to this post.

  1. I almost never leave responses, but i did a few searching and wound up here Convert
    ASP.Net webform to ASP.Net MVC | Nathan. And I do have 2 questions for you if you don’t mind. Could it be simply me or does it give the impression like some of the remarks come across as if they are written by brain dead visitors? 😛 And, if you are posting at other social sites, I’d like
    to keep up with anything new you have to post. Could you make a list of the complete urls of your public sites like your twitter feed, Facebook
    page or linkedin profile?



Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s

A %d blogueros les gusta esto: