Integrating DotVVM with ASP.NET MVC, Web Forms and other frameworks

Published: 4/17/2017 10:36:12 AM

One of the most frequent questions about DotVVM is the integration of DotVVM with other web technologies, like ASP.NET MVC, ASP.NET Web Forms, SignalR or Nancy FX.

The answer is yes, DotVVM can be used together with ASP.NET MVC, ASP.NET Web Forms or other ASP.NET-based technologies in one application.

We have prepared examples of combination DotVVM with other technologies in one app:

Each repository contains a readme with a step-by-step tutorial on how to add DotVVM in the existing application.

 

OWIN

If you install the DotVVM.Owin package, DotVVM will run as an OWIN middleware. You may already have the OWIN pipeline in your ASP.NET application, because some frameworks like SignalR use it.

If you don’t have OWIN in your project, you need to install the Microsoft.Owin.Host.SystemWeb NuGet package and you need to create the OWIN Startup class in your project. This class contains the Configure method which is executed when the application starts. Its purpose is to install middlewares in the OWIN pipeline. Each HTTP request then goes through this pipeline and one of the middlewares takes care of it.

The only thing you need to do is to call appBuilder.UseDotVVM… in the Startup class.

If you look at the samples, you can see that one of the steps tells you to add a DotVVM Project Guid in the <ProjectTypeGuids> element in the .csproj file. This is not required, but if you want to have a better development experience with DotVVM for Visual Studio, you should add this guid.

 

ASP.NET Core

ASP.NET Core is a new stack for building web applications. Its principles are very similar to OWIN – you also need to install the appropriate middlewares in certain order to handle the HTTP requests. The API is a little different and some things have changed too, but there is also the Startup class with the Configure method.

To use DotVVM with ASP.NET Core, you need to install the DotVVM.AspNetCore package. Then you only need to plug the DotVVM middleware in the pipeline.

Tomáš Herceg

I am the CEO of RIGANTI, a small software development company located in Prague, Czech Republic.

I am Microsoft Most Valuable Professional and the founder of DotVVM project.