views:

109

answers:

3

I've got a pretty simple site (around 8 pages) with only one way page containing any significant codebehind, and I'd like to try learning MVC, using it as the test.

Is it best to start a new MVC Web App from scratch and cut-and-paste the HTML in, or will it be easier to retool the existing files.

Basically, what am I in for? What's it gonna take to get my Web Forms app into the MVC model? What approach should I take? Create the default MVC web app and start cutting-and-pasting? Add the appropriate namespaces and learn to setup the MVC structure myself?

A: 

You'll want to start from a project template in a new project. Transfer your markup to your new views as needed, although it's more likely that you'll just be using the old site as a design template than actually reusing code. You'll find that MVC is much different than WebForms.

tvanfosson
+2  A: 

Unlike tvanfosson, I think you will actually learn more about MVC by trying to translate your existing application. You'll learn which assemblies to add, you'll work out how to associate the right http handlers, you'll learn what the correct web.config settings are, and you'll know which dependencies to remove from your web application to get it to work.

To be honest, it will feel harder doing it this way and be a little more frustrating, but at the end of the process you will know a hell of a lot more than just starting a new one from scratch. Good luck with it.

DarkwingDuck
A: 

I don't think retooling the existing Web Forms application is the best approach (or even feasible). As you will surely discover, the differences between Web Forms and MVC are quite big. So, starting from scratch (although you can recycle the html) will most likely be the better approach and the best way to learn as much as possible about MVC.

Seventh Element