DiegoS
DiegoS

Reputation: 826

ASP .NET MVC & WebForms - Two projects and one final site

Is there a way to have a web site with some pages in ASP .NET MVC project and other (legacy pages) in ASP .NET Webforms in a way that the navigation is quite transparent to the final user?

Also, what happends with the URL?

I can't use a mix of web forms and mvc in the same project (althought i know it's possible)

Architecture

I want to use this approach to make the transition from web forms to mvc easier and whenever a new page is added put that page on the mvc project without affecting the current web forms working project.

Upvotes: 3

Views: 878

Answers (2)

Mikael Dúi Bolinder
Mikael Dúi Bolinder

Reputation: 2284

  • You can host the state in a SQL Server shared between the sites.
  • You can have URLs in DB to have them in-sync between the sites. A start-up script of the MVC app could register its URLs automatically using the route collection.

Upvotes: 0

Chris Pratt
Chris Pratt

Reputation: 239290

Not really. One project = one website. You can technically deploy one or the other as a virtual application under the other, but this would still be two separate websites. They'd come up under the same domain/subdomain, but they would not be able to communicate with each other in terms of routing and such, i.e. there would be no way to get a URL for something in your MVC project from your Web Forms project.

MVC is backwards-compatible with Web Forms, so that you can migrate over to MVC in-place. In other words, you can add the MVC Nuget packages to a Web Forms project and start working with MVC in that same project while maintaining your existing Web Forms pages. That is how you do an upgrade. If you don't want to do it that way, your MVC site will have to be its own thing, hosted separately.

Upvotes: 4

Related Questions