16
votes

I am trying to migrate a project from classic ASP.Net Web Forms to ASP.NET MVC.

While I have read through http://www.codeproject.com/Articles/38778/ASP-NET-WebForms-and-ASP-NET-MVC-in-Harmony. I have a basic idea on how the code structure, libraries and routing should be done.

For your information, the scope of my existing project is around 400 pages and 300 tables.

On top of my head I have two approaches:

  1. Start from stretch, rewriting the whole system - Obviously this would require intensive work and take a long time. Any change made on existing system would need a duplicate change made to the new system.
  2. Migrate the page one each - I still have a rebuild the entire core library (for accessing db), and get the page migrated one by one. For this I would assume to have two core libraries (new and old) running simultaneously with different pages connect to one of those.

Would anyone have similar experience and advise a proper way to start?

For this complete revamp I may also target at the latest technology - .NET Core and MVC6, by taking these would I have extra advantage, or some blockages I would have to take care of?

Any suggestion and opinions are appreciated. Cheers.

3
Just curious, what did you end up doing? I am in a similar position - legacy WebForms app. I want to convert it to MVC/.Net core.costa
@costa I had similar experience on three systems from two companies, ended up a complete rewrite. Consideration was taken on maintaining existing system stability and minimizing development complexity.ydoow
interesting. For us re-writing the entire app is not an option. We would have to gradually convert pages to the new technology, i.e. option 2 in your post. Did you migrate to .Net core or MVC? I am reluctant to update to .Net Core. It seems that people ran into issues.costa
.NET Core would be the direction if you look forward to getting benefit from open source and cross platform. Good luck on the rewrite, may also consider bring up a new system and bridge each page across.ydoow
By now you would be done with this migration. I am looking for the same sort of migration and found DotVVM and Blazor. Now you would be in a better position to make some recommendations for me.bjan

3 Answers

17
votes

Microsoft is a bit hush hush on the subject but the WebForms engine is probably never going to make its way to ASP.NET Core. One might think that MS is waiting to see if the community is calling for a port, but I think they're trying to kill it discretely (not like Silverlight).

Why? Because it proved to be a bad good idea on the long run, easy to use at first, but extremely complex to master (because of viewstate and page lifecycle), with a tendency to allow average developers to build very tedious application (in french we say steam factories). Also it was very poorly adapted to modern web development (Ajax, unit testing, IoC). They tried to fix it with a couple of tweaks, but the overall architecture is just not adapted to this kind of things. MVC is a treat in comparison!

To answer your question, it's not really possible to migrate WebForms to MVC, because those are quite different architectures, and of course the architecture is what an application sits on top on, so if you change it, you might as well rewrite it from scratch.

What can help you a lot is if your app is divided in tiers (business, data access, UI). If it's not the case, you could start by doing this, properly separating the UI project from the rest. Then you would just have to rewrite the ASP.NET project and not the rest.

1
votes

There are some useful resources I'd like to share with the StackOverflow community just in case you are having troubles to decide what to do:

  • modernization of your existing Web Forms app
  • migration to MVC or Core
  • or whether to start a new project on Web Forms, MVC and Core.

Here you go:

0
votes

i have come across below links

https://www.youtube.com/watch?v=CZuqMrWSano https://www.dotvvm.com/blog/59/Modernizing-ASP-NET-Web-Forms-applications-with-DotVVM

DotVVM package helps us to migrate ASP.Net Web Forms migration to ASP.NET Core without re-writting completely.

i have not tried any production application. still have tried some sample pages. you can try this out.