Reputation: 72
I have our legacy ASP.NET web forms application. I need to create new pages and I want to use the APS.NET Core MVC project for those new pages. Is this possible? How It can be done?
Just to add, I don't need to keep the state b/w pages from both projects.
I tried to create a separate MVC core project (under the same solution) but can't figure out how to do the routing between them.
Edit: I know this is possible by using MVC .NET Framework. My question is specific to MVC Core.
Upvotes: 1
Views: 901
Reputation: 33917
No, you can not. While the objects used by the request pipeline seem very similar between the Asp.Net and Asp.Net Core, they are in fact totally different objects which come from totally different namespaces. The two are totally different pipelines that don't interact in any way. So at the end of the day it's either going to be one pipeline listening for incoming web requests or it's gonna be the other. You can't have both trying to process the web request for your web application.
By way of contrast, in the Asp.Net when using the Full framework you can have Web Forms and MVC both coexist no problem. This is because both use the same request pipeline that lives in the System.Web
namespace. So while the way they respond to the request might be a bit different, they both use the same HttpContext
object. This is not true of Asp.Net Core. It uses a totally different HttpContext
object located in the Microsoft.AspNetCore.Http
namespace.
You may also find my answer for this question informative: Is it at all possible to migrate ASP.NET ASPX solution to ASP.NET Core 2.0?
Upvotes: 3