3

I currently work for a company that uses a combination of ASP.NET Webforms and legacy ASP pages for web development. This works fairly well for their current projects but I would like to convince / suggest to them to switch over to ASP.NET MVC since most of their codebase consists of wiring form elements to stored procedure parameters. Just using an ORM is also a possibility but I think it would be a good idea to use this opportunity to switch to an MVC framework.

However, I'm not sure how easy it will be to deploy an ASP.NET MVC app along side ASP.NET and Classic ASP code while the codebase is updated. First, I would like to ask if this is even possible. I've seen threads about running ASP.NET with Classic ASP and ASP.NET MVC with Webforms but not all three in the same application. They currently have Webforms and Classic ASP working together so the pitfalls associated with that are already solved. Second, what are some strong selling points that would help me convince the rest of the team that learning a new framework and converting existing code will be worth it in the long run?

2

2 Answers 2

8

I see this is an old question, but since I'm in the same boat I thought I'd give it a shot.

I've got a 100k+ page site written in Classic ASP over the past 12-15 years. Unlike a lot of hacked-together code, it's well structured, complicated, and efficient, and has been refined to such a degree that bugs are very, very rare.

A lot of the new features that were added over the past three or four years were implemented in ASP.NET. This has required reimplementing a lot of the underlying DAL and business logic, and, of course, the new stuff is never as stable as the code that's been running without a hitch for close to a decade. It's also very, very nice to keep the source off of the server and away from prying eyes and fingers.

I resisted MVC at first, but I've come to love it. It doesn't offer all of the features of Webforms - easily packaged and redistributable user controls is something that I really, really miss - but it's much more traditional app development than web development, which I like. It's also significantly easier to write tests for - a huge selling point for me.

So, the current Visual Studio solution looks like this:

  • a bunch of .NET class libraries (DAL, etc)
  • an ASP web application project containing all of the old code and all of the webforms stuff
  • an MVC web application project.

IIS is pointed to the MVC project folder, so all of the MVC stuff just works as expected. The website configuration includes virtual folders for all of the ASP stuff that hasn't been migrated (this will take years). Those virtual directories point to a folder outside of the MVC folder structure where the Webforms and Classic ASP code/objects are stored. When IIS receives a request, things that are mapped to the virtual folders are processed by classic ASP or the webforms, while everything else is routed to the appropriate MVC area.

I keep these projects separated intentionally; having a single solution with ASP, MVC and webforms all in the same folder structure is a sure path to insanity.

It works quite well, but was a bit of a pain to get configured at the get go.

So, yes, all three technologies will happily exist in the same site, but you've got some organizational challenges ahead of you.

6
  • David, What did you do about the session? How does the session get shared/transferred across these apps? May 19, 2011 at 17:49
  • @CF_Maintainer I haven't used a session variable since the late 90s. You could move from session() to a database and then handle it yourself (both apps would store whatever state information you need in the db, so anything can get to it).
    – 3Dave
    May 19, 2011 at 17:58
  • DAvid, Thanks for the response. This classic ASp app uses Session heavily, hence the question. I rarely do web work and rather than sitting on the bench, I have been assigned a gradual migration of this classic asp app. May 19, 2011 at 18:04
  • David, so you would suggest storing the current user credentials and a guid identifier in the db and pass the guid identifier to the asp.net mvc app to pull the credentials and confirm them? That would mean removing the db entry on logoff or session expiration. May 19, 2011 at 18:06
  • No, just add an expiration datetime column to the db, and update it on each page request to now+20 minutes. No need to remove it: actually useful to run a report on which users are active and how frequently.
    – 3Dave
    May 24, 2011 at 23:07
1

It is possible to run a site that is partially standard Asp.net as well as Asp.net Mvc. As for classic ASP, I've never done it, but I imagine if it runs alongside standard Asp.NET, then MVC won't be an issue.

As for why, remind them that classic ASP isn't a desirable skill in the marketplace. Some people will always resist change and new technology (because the old stuff works fine, and they are probably right). Find the developers that are eager to trade up in skill sets, and get them to band together. But make sure MVC makes sense for the application. Management is likely to wonder why they need to make the big time investment to upgrade when the old stuff is working just fine, and that will be a harder sell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.