We inherited a large ASP.NET website built entirely in WebForms. The website has over 200 pages, spread across 60 WebForms projects inside of the website's solution. About half of the pages are static content while the other half has a varied amount of server side complexity, mainly data capture and display. There is no use of ASP.NET web server controls as we've been phasing them out in favour of pure html. We handle SQL data via (a lot of) stored procedures on the SQL server. Our servers run Windows Server 2012 R2, IIS 7 with ASP.NET 4.5 framework.
We're researching if it's feasible to gradually convert to MVC or if a full MVC re-write is the best way to go.
To avoid becoming too broad, this question is about the general (non project-specific) procedure of converting a WebForms ecosystem into an ASP.NET-MVC ecosystem. And the specific focus is effort estimation (given the above project measurements). Own research
The reasons why we want to convert WebForms to ASP.NET-MVC are mainly:
- routing and SEO friendly URLs,
- better structure and separation of code,
- the Entity Framework for central management of data,
- scaffolding for speedy development via auto generation of code,
- the Web API for AJAX communication and seamless update of page without refreshing, -- and to move away from the no longer supported (since .NET 5) webforms platform.
We understand that some of these concepts can be plugged into webforms but not as well integrated as in MVC. We'd like to take advantage of the flexibility that MVC offers.
So, I suppose we're going to need to do something like the following:
- convert gradually:
- add an MVC skeleton structure that covers a specific part (likely the site .master and respective controls (.ascx) and a single WebForms project)
- fill in the structure with functionality, reusing relevant chunks of existing code by refactoring them as needed full rewrite:
- create a full MVC structure, possibly creating a new project structure, re-partitioning functionality between them
- fill it in by copy-pasting existing code or rewriting parts that are easier this way
These may be incorrect, of course; as I said, it's what we have for now. Questions:
Could you outline a high-level conversion procedure in either case?
- in the gradual converting scenario, what's the most painless process?
- To re-write and replace the site .master and dependent controls to MVC layout and views and then load the remaining yet to be converted content into the new MVC layout?
- Or to load views into the existing master page?
- Or can you suggest and alternative method that will minimize duplicate MVC and webforms content during the transition period?
- in the full rewrite scenario, is it preferable to combine everything into a single MVC project, keep the existing 60 projects structure or repartition the functionality by an MVC-friendly principle? Currently the project structure matches the URL structure.
Any guidance or constructive feedback would be much appreciated.