Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can "classic" ASP.NET pages and Microsoft MVC coexist in the same web application?

I'm thinking about trying out MVC later today for a new app we're starting up, but I'm curious if it's an all or nothing thing or if I can still party like it's 2006 with viewstate and other crutches at the same time...

like image 777
jasondoucette Avatar asked Sep 25 '08 11:09

jasondoucette


2 Answers

Yes you can have your webforms pages and MVC views mixed in a single web application project. This could be useful if you have an application that is already built and you want to migrate your app from webforms to mvc.

You need to make sure that none of your webforms pages go in the 'Views' directory in a standard ASP.NET MVC application though. Pages (or views) in the 'Views' directory can't be requested directly through the url.

If you are starting an application from scratch, there would be very little benefit to mixing the two.

like image 159
Chris Sutton Avatar answered Sep 29 '22 01:09

Chris Sutton


Yes. MVC is just a different implementation of the IHttpHandler interface so both classic ASP.NET and ASP.NET MVC pages can coexist in the same app.

like image 34
Joel Cunningham Avatar answered Sep 29 '22 01:09

Joel Cunningham