Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can ASP.NET MVC 3 run inside a ASP.NET 3.5 web site?

I would like to know if it is at all possible to get an MVC3 solution wrapped in a CWAB (Composite Web Application Block) solution built in 3.5?

I'm aware that in IIS, 2.0/3.5 and 4.0 sites can run next to each other (but in different application pools) but because of the CWAB layer I do not have this luxury. I got MVC2 running successfully before but MVC2 is on the 2.0 runtime if what I've read is true.

I would really like to use Razor as well so going back to MVC2 in this scenario is not really an option.

like image 595
Wizard of Oz Avatar asked Jan 28 '11 15:01

Wizard of Oz


People also ask

Can we plug an ASP.NET MVC into an existing ASP NET application?

Luckily, the answer is yes. Combining ASP.NET Webforms and ASP.NET MVC in one application is possible—in fact, it is quite easy. The reason for this is that the ASP.NET MVC framework has been built on top of ASP.NET.

Can MVC and ASP Net coexist?

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.

What are the 3 main components of an ASP.NET MVC application?

The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications.

Does MVC use ASP net?

The ASP.NET Core MVC framework is a lightweight, open source, highly testable presentation framework optimized for use with ASP.NET Core. ASP.NET Core MVC provides a patterns-based way to build dynamic websites that enables a clean separation of concerns.


2 Answers

It should be possible. Just set your application pool runtime to 4.0 instead of 2.0.

.NET 4.0 runtime will be able to handle .NET 3.5 assemblies.

like image 106
Aliostad Avatar answered Sep 21 '22 09:09

Aliostad


Razor requires features in .NET 4.0. However Tom Clarkson has a post called ASP.NET MVC 3 Razor View in SharePoint that talks about a (not-so-pretty) work-around. Basically, generate the view code from the cshtml files in .NET 4 and you can use them in .NET 3.5 (with a modified RazorEngine).

like image 32
chrish Avatar answered Sep 23 '22 09:09

chrish