I'd rather be doing MVC as the regular WebForms development eats my soul.
However, I've been given a fairly sizable WebForms project to add a bunch of features to.
Is there anyway for WebForms and ASP.NET MVC to coexist in single project or even jointly handle the website? I know I am asking for a hack.
Now in 2011 we have .NET 4.0 and is fairly easy to combine them. Just start a new MVC3 project, add a HomeController and a view (i.e. Home/Index.cshtml), then add a new folder, let's say /Admin, then add a web form inside it like /Admin/Default.aspx... that's it, run it, the home page will use MVC, the admin section will use web forms.
I haven't done it - but it appears to be possible according to this Chad Myer's blog post. It's a bit old. http://www.chadmyers.com/Blog/archive/2007/11/30/asp.net-webforms-and-mvc-in-the-same-project.aspx
If you have room for another book I highly recommend Steve Sanderson's book http://bit.ly/1W03Tv (I'm not a mole...it's just helped me a ton). He has a chapter in there about "Combining MVC and WebForms".
I thought about summarizing the process out here but it's a bit lengthy. Give it a look if you get a chance.
This is what I did to add MVC5 to an existing Web Forms project
Create a new ASP.NET MVC project. You can use it to copy info to your existing project.
In your existing project, use nuget to add the references. This will also update your Web.config and add the jQuery files. Copy this in your Package Manager Console
Copy BundleConfig, Routeconfig, FilterConfig and any others you need to App_Start
Add the register lines from
Application_Start
to Global.asax. You can get them from your new project.Add these keys to the
<appsettings>
of your Web.configAdd a reference to the Microsoft.CSharp assembly
Add the Views and Controllers folder
Now you can start adding views and controllers as you would do in any Mvc project
Also - in order to add the context menus, add the "MVC" project type ({E53F8FEA-EAE0-44A6-8774-FFD645390401}) to the project file as such
Here goes...
This is a very rough explanation but you asked for the cliff notes. Moral of the story is to follow along with a new/blank mvc project and add the necessary entries in web.config, reference the necessary assemblies, and create the correct file structure for the mvc pattern.