CiccioMiami
CiccioMiami

Reputation: 8266

Using ASP.NET Web Forms and MVC applications within the same solution

I have an ASP.NET Web Forms application in one project. Under the same solution I have two different projects: one Repository layer and one Service layer.

Eventually I will rewrite my ASP.NET Web Forms application in MVC, therefore I want to implement all the new functionality by using MVC.

I have to create a registration form for customers and at one point if a condition verifies, I have to bring the customer to another form and then back to the registration form.

Will it work if I create an MVC application project within the same solution? The application will also use the Service and Repository layers. What about the Session object?

Upvotes: 1

Views: 1211

Answers (1)

Jeremy Bell
Jeremy Bell

Reputation: 718

Just add the MVC controllers/views to your Web Forms application. They can run side-by-side just fine. This will allow you to upgrade parts of the site to MVC while keeping your existing Web Forms pages running.

The web layer (which has both MVC and Web Forms) can still access all of your application framework logic (repository, service, session, etc...)

Scott Hanselman created a Nuget Package for easily upgrading your web forms app to Mvc 3: http://nuget.org/packages/AddMvc3ToWebForms

Upvotes: 1

Related Questions