Mark Kadlec
Mark Kadlec

Reputation: 8440

How do I use Webforms and ASP.NET MVC together in an ASP.NET Webforms Website project?

I've seen a lot of articles creating hybrid Web Forms applications to also have MVC pages and those work fine.

Unfortunately, I've inherited a Web Forms Web Site (not application), so there is no way to edit project files, add references, etc.

How do I use Webforms alongside ASP.NET MVC when the project is a Web Site project?

Upvotes: 0

Views: 668

Answers (2)

Jeremy Bell
Jeremy Bell

Reputation: 718

There is a way to convert a website into an application:

How To Convert ASP.NET Website to ASP.NET Web Application

Scott Hanselman also created a NuGet package for adding MVC into a Webforms application:

https://www.nuget.org/packages/AddMvc3ToWebForms/

Upvotes: 1

TombMedia
TombMedia

Reputation: 1972

It's actually pretty easy to convert a web project to a web application. And from there you can use the 2013 web application project to have webforms, webapi, and mvc all live and play along in the same application.

However, take a look at ASP.Net vNext. They have removed webforms from that model and are using asp.net webpages much like what you are using now. That will be able to work with webapi and mvc so you might want to start learning that instead of converting to see if the programming model fits your upgrade path a little better.

Upvotes: 1

Related Questions