tom
tom

Reputation: 1822

ASP.Net MVC and Web Forms applications using same domain name, but code is kept in separate solutions

I have an old web forms application (.net 3.5) hosted at www.business-app.local

I want to build a new ASP.NET MVC (.net 4.0/4.5) application that will also have the domain name www.business-app.local

I know I can't have two applications with the same domain and port on IIS. I have tried adding the MVC app in a virtual directory but hit a bunch of web.config clashes.

I want to keep the two applications separate, i.e. it is not a solution to just add the web forms pages to my MVC application, or to add MVC to the web forms application.

How can I achieve this using IIS 8?

Upvotes: 0

Views: 1105

Answers (3)

tom
tom

Reputation: 1822

I have had to compromise and put them two apps on separate sub domains with a common cookie.

Upvotes: 0

Moby's Stunt Double
Moby's Stunt Double

Reputation: 2550

The easiest way to do this is to create your new MVC app and add the folders containing the webforms into it. Queti mentions doing this the other way around, but honestly, it's a massive PITA, as you have to hack around with config files and references.

Once you have your webforms pages in specific folders in the MVC app, simply add exclusions for them from routing in global.asax.cs like so:

routes.IgnoreRoute("Webformsfolder/{*pathInfo}")

Also, seeing as you are (I presume) phasing out the webforms stuff eventually, it's probably best to start from scratch anyway, IMHO. Good luck!

Upvotes: 1

Andy T
Andy T

Reputation: 9881

You could add MVC to the current application. The trick is to make sure that the routes do not conflict with the web forms directories otherwise the WebForms will be the ones that handle the request.

This is the process I've followed when migrating Web Forms sites to MVC.

Upvotes: 0

Related Questions