<p>ASP.NET MVC has been <a href="https://stackoverflow.com/questions/tagged/mvc">discussed</a> on this forum a few times. I'm about to do a large <strong>migration</strong> of several websites from classic ASP/ASP.NET WebForms to ASP.NET MVC and was wondering what kind of advice those of you with experience in both technologies have.</p>

<p>What I have: a typical ASP.NET app with heavily coupled presentation/business logic, all sorts of messy ASP.NET-generated Javascript cruft, and so forth.</p>

<p>What I want: clean ASP.NET MVC-generated agnostic markup. 'Nuff said.</p>

<p>Any pointers, tips, tricks, or gotchas to be aware of?</p>

<p>Thanks!</p>

[{'answer_id': 13706, 'author': 'Keith', 'author_id': 905, 'author_profile': 'https://Stackoverflow.com/users/905', 'pm_score': 2, 'selected': False, 'text': "<p>Wow, I'm not sure we're talking migration here anymore - the difference is more like re-writing!</p>\n\n<hr>\n\n<p>As others have also said, MVC is a whole new way to build web apps - most of your presentation code won't carry across.</p>\n\n<p>However, if you are re-writing in MVC what you already have is a good prototype. Your problem is likely to be that it would be hard to do bit by bit - for instance MVC uses URL renaming out-of-the-box, making linking back and forth rather messy.</p>\n\n<p>Another question would be why? Many of us have big sprawling legacy applications that we'd like to be in the latest technologies, but if your application is already working why switch? </p>\n\n<p>If I was looking at a new application right now MVC would be a very strong candidate, but there's no gain large enough to switching to it late in a project.</p>\n"}, {'answer_id': 13714, 'author': 'Dale Ragan', 'author_id': 1117, 'author_profile': 'https://Stackoverflow.com/users/1117', 'pm_score': 0, 'selected': False, 'text': '<p>My opinion is that the two technologies are so different that if you have tightly coupled code in the original Web Form applications that the best approach is to start by picking one of them and converting it by creating a new ASP.NET MVC application and ripping out code into their respective layers.  Which will put you on the trail of reuse for porting the other applications.</p>\n'}, {'answer_id': 13726, 'author': 'Nathan', 'author_id': 541, 'author_profile': 'https://Stackoverflow.com/users/541', 'pm_score': 3, 'selected': True, 'text': '<blockquote>\n  <p>Any pointers, tips, tricks, or\n  gotchas to be aware of?</p>\n</blockquote>\n\n<p>Well, I think you\'re probably a little ways away from thinking about tricks &amp; gotchas :) As I\'m sure you\'re aware, ASP.NET MVC is not some new version of ASP.NET, but a totally different paradigm from ASP.NET, you won\'t be migrating, you\'ll be initiating a brand new development effort to replace an existing system. So maybe you can get a leg up on determining requirements for the app, but the rest will probably re-built from scratch.</p>\n\n<p>Based on the (very common) problems you described in your existing code base you should consider taking this opportunity to learn some of the current best practices in designing loosely coupled systems. This is easy to do because modern "best practices" are easy to understand and easy to practice, and there is enormous community support, and high quality, open source tooling to help in the process.</p>\n\n<p>We are moving an ASP/ASP.NET application to ASP.NET MVC at this time as well, and this is the conclusion my preparatory research has led me to, anyway.</p>\n\n<p><a href="http://www.thefreakparade.com/2008/07/to-aspnetmvc-or-not-to-mvc-or-aspnet-mvc-hyperlink-acupuncture/" rel="nofollow noreferrer">Here is a post to links on using ASP.NET MVC</a>, but I would start by <a href="http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-12-prerequisites-or-nhibernate-marijuananet/" rel="nofollow noreferrer">reading this post</a>. The post is about NHibernate (an ORM tool) on its surface but the discussion and the links are about getting the foundations right and is the result of preparing to port an ASP.NET site to MVC. Some of the reference architectures linked to in that post are based on ASP.NET MVC. <a href="http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-1-of-1-the-links/" rel="nofollow noreferrer">Here is another post about NHibernate</a>, but in the "Best Practices &amp; Reference Applications" section most if not all of the reference applications listed are ASP.NET MVC applications also. Reference architectures can be extremely useful for quickly getting a feeling for how an optimal, maintainable ASP.NET MVC site might be designed.</p>\n'}, {'answer_id': 31588, 'author': 'Haacked', 'author_id': 598, 'author_profile': 'https://Stackoverflow.com/users/598', 'pm_score': 1, 'selected': False, 'text': '<p>WebForms can live with MVC controllers in the same app. By default, routing does not route requests for files that exist on disk. So you could start rewriting small parts of your site at a time to use the MVC pattern, and leave the rest of it using WebForms.</p>\n'}]
['https://Stackoverflow.com/questions/13704', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']