Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to gradually convert an existing ASP.NET site to MVC

Tags:

Please keep in mind that this is new for me and I might have missed something important.

I have an existing website, based on an ASP.NET web application. I am now using ASP.NET MVC for new development, and intend to gradually replace the bulk of the pages with MVC based pages.

I have two issues here:

1) I need to replace the pages gradually, because I cannot convert everything at once. 2) Existing URLs (of physical files) should be preserved if possible.

The way I see it, I have the following options:

1) Create a brand new MVC web application in the root of the web site, and then include existing HTML/ASPX/ASMX/... pages to that. This way, the routes are always relative to the root of the web site.

2) Modify the existing Global.asax, Web.config, Default.aspx (and so on) to switch the MVC handler on for routing, and then publish my MVC application to a subfolder.

What is the easiest way to do that, and am I missing something?

Thanks, Laurent

like image 783
LBugnion Avatar asked Oct 17 '08 11:10

LBugnion


People also ask

Can we plug an ASP.NET MVC into an existing ASP.NET application?

Luckily, the answer is yes. Combining ASP.NET Webforms and ASP.NET MVC in one application is possible—in fact, it is quite easy. The reason for this is that the ASP.NET MVC framework has been built on top of ASP.NET.

Is ASP.NET MVC discontinued?

ASP.NET MVC is no longer in active development.

Is MVC faster than Web Forms?

If you want to have a faster development cycle than Web Forms might be the best option. If time, money, and energy to develop an application from the scratch is not a constraint then MVC could potentially be the better option.


1 Answers

Like you, I'm tackling this same problem. A few things I ran into I've posted about here https://stackoverflow.com/users/84825/mouffette and they are mainly related to SETUP. The best thing to do is start a new MVC project and compare the files and structure to your existing ASP.NET application. When in doubt just move over line by line and web.config's and eventually you'll get it ;-)

Once you have the plumbing working you then can focus on MVC and it just works side by side.

These links have also helped:

http://media.wiley.com/assets/1539/15/professionalaspnet35mvc_chapter13.pdf http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf

and you've already found the best site...stackoverflow.

like image 179
Mouffette Avatar answered Oct 04 '22 23:10

Mouffette