Thursday, January 6, 2011

Can we use ASP.NET WebForms and MVC together in one project?

Yes.
1. Easiest way: Create a MVC project, add web form into it.
2. Another way:  Update your web forms project to support MVC on top it. Steps following:
- Add  references to System.Web.Abstractions, System.Web.Mvc and System.Web.Routing
- Update web.config. Compare your web form project to a empty MVC one
- Add routing code into Global.asax.cs
- Create folders for Controllers and Views

References:
http://blogs.imeta.co.uk/MGodfrey/archive/2009/03/31/663.aspx
This one is for MVC 1.0. You need to adjust for 2.0

http://www.sqlmag.com/article/aspnet2/MVC-and-Web-Forms-Two-Great-Tastes-Together-.aspx

No comments:

Post a Comment