views:

1179

answers:

10

I'm doing some maintenance on a classic ASP application for my client, and as I'm looking through the ASP, the following question comes to mind - would it be easier to convert a classic ASP app to ASP.NET MVC or ASP.NET WebForms?

In many ways, it appears that at least the HTML of ASP might be easier to convert to MVC than it would be to rip out the HTML chunks and turn them into ASP.NET controls, repeaters, datagrids, etc. Plus having to add in handling and logic for ViewState, etc. might be added work.

I don't think my client will be requesting any upgrade like this, so this is just theoretical.

Let's assume that this ASP code is written very well (which isn't always true of course) so really the question is, will a best-case-well-designed ASP site migrate better to MVC than WebForms?

(Note that I'm very new to ASP.NET MVC, so I might be missing something crucial here).

+2  A: 

There is more to ASP.NET-MVC than the apparent similarities between view code and ASP inline code. There is all the Model and Controller parts to consider which is very different from the way most ASP is written.

That said I would say that MVC would be the best place to start.

AnthonyWJones
A: 

IMO WebForms attempt to hide html too much for my liking and may cause your project to take longer than you would like due to converting a lot of html into the webforms controls.

On the other hand MVC allows you to reuse some of this logic while making your application much more maintainable and with the appropriate Architectural Pattern your application can be developed and refactored much quicker than any WebForms project.

I say MVC all the way!

Kelly
+4  A: 

I think in a lot of cases it could be easier to convert to MVC than Webforms. Most classic ASP apps demonstrate very little separation of concerns so the biggest task is probably exactly that, seperating out the logic into data access, business logic, business entities and UI components. In doing that it could well be easier to convert the inline ASP code to a view, the business logic into controllers and the business entities into the model.

AdamRalph
+2  A: 

I don't think one would be easier to convert then the other.

You can code ASP.NET almost the same as you code ASP if you wanted putting a few crucial elements in the codebehind that you could access in the aspx. No databinding, no gridview and no repeater. The view state is there to help you can is easy to figure out, it is not necessary to use it if you don't want and can be turned off in the web.config and turned on with a page attribute. Web forms also have an AspCompat mode which allows access to Request and Response objects or asp, which will allow for page by page conversion if desired.

As for MVC.net, the method for displaying the HTML is quite similar. That in my opinion is where the similarities end. You would still need to separate out all you logic into the MVC model.

Coming from ASP and going to Web.Form and now MVC.Net I can tell you that WebForms were a little annoying/frustrating to learn, with 90% of the MS tutorials teaching you the worst possible habits IE (SQL connections on the page, dragging datasets around in designers). However, once you get past that one is able to do a lot of thing much more quickly then in asp(pagination or build a simple datatable with editing for example), I have however STILL never seen a large webforms project with an n-tier design that I thought was easy to follow, implement and use.

MVC.NET is like a godsend. It forces patterns and practices down your throat, it has strict rules that are adhered to by most. It allows for easy code coverage and separation of concerns. After being frustrated with webforms for years it finally feels like I am not hacking things together when attempting to do something that I cant drag off the tool bar.

I personally would try webforms so you will know how much better MVC is when you start using it.

cgreeno
+5  A: 

It depends a lot on how the classic asp app is structured.

The server tag mixed in with HTML is similar to asp.net mvc but MVC is not as messy (or not supposed to be). You might be able to move the classic asp presentation code to a MVC view easier than to a web form. Also classic asp apps were usually developed with the statelessness of the web in mind. There probably is not anything in your classic asp that matches postabacks or viewstate. Classic ASP also uses normal html elements as opposed to asp.net webform controls. In these respects it matches MVC a lot closer than webforms.

If you do not know asp.net webforms or asp.net mvc I would say MVC is the way to go.

If you know webforms very well and don't know much about MVC I would say webforms is the way to go.

But, if your client for some reason does want a redevelopment of the site I would say go with MVC. It's always nice to have a client pay for part of your experience development as long as you can deliver.

On another note I'm always taken aback when I come across a client who wants me to do work on their classic asp site. In every single case the site is a mess. The worse part is that they are usually filled with huge security holes.

metanaito
+1  A: 

Either way, it's always best to start from scratch and implemented only the logic.

I started ASP a long time ago (more than 12 years ago) and only in 2006 I moved to ASP.NET 2.0, not even today I know all, but I do know pretty much what I do everyday at work.

In my opinion now, and looking back to my knowledge of ASP I would go to Web Forms instead of MVC, first, it's a language that it's in the "market" some some yeras now and very used across the world, while MVC is still in Beta, so, not suitable for production environment (says Microsoft - even if this site is written in MVC).

I do tend to make confusion with MVC diagram still, and there are more tricks than I want to learn if I need to do a fast change of one ASP project.

balexandre
+1  A: 

It depends. The ASP.NET MVC is no silver bullet and in many ways takes a few steps backwards in terms of developer productivity.

If you have a tight budget and need to get this done fast I believe ASP.Net is the way to go since it has the wealth of controls like grids, paging, validation etc that you can use right out of the box. Using these controls will no doubt save a lot of dev time. All of these controls that most consider pedestrian by now in ASP.NET all have to be created from scratch or taken from the Internet when you use the ASP.NET MVC project.

On the other hand if you have the time and budget now and going forward, and you want to have a solution that is rock solid, and more easily lends itself to test driven development, the ASP.NET MVC is probably the best choice.

James
A: 

Definately ASP.NET MVC is better in terms of style. (That said, you don't have to use Repeaters and other silly controls in a WebForms app, you can simply use inline code just like you would in MVC.)

MVC in general though would be an easier port, give you a better structure and be a more pleasant experience.

mike nelson
A: 

I work on classic asp for a small company

The cms they use was developed on classic asp,vb 6.0 and sql server 2000.

I have upgraded the database server to slq server 2008 due to some isses with old server and during that process was asked to migrate our classic asp web application so I have moved it to IIS7.

Now I am getting complains from users that the application is slow alteast once a day.

I belive at some point we have to rewrite classic asp and the vb DAL as well.

I would like to know if there is some thing that I can check to see why the application slows down.

Would it be possible to migrate to mvc? what would it take to migrate? Does microsoft have any resources related to classic asp migration?

thanks