C# – Can System.Web be used with ASP.Net Core with Full Framework

asp.netasp.net-corecformsauthenticationnet

We are running serveral sites based on different .Net versions.

One of the sites is running .Net 4.6 and ASP.Net MVC 5.xx

To use the new syntax for Razor we want to upgrade this site to use .Net 4.6 and ASP.Net Core

We use FormsAuthentication on our sites, and we will continue using that so user can move between sites. (one of the sites is a SharePoint site running FormsAuthentication)

We understand that ASP.Net Core is not using anything from System.Web but we need to use that from controllers (to create FormsAuthentication cookie during login) and from HttpModule to verify cookie.

I have not been able to find any example how to use system.web from a site running ASP.Net Core with Full framwork. I have not been able to add dependency for system.web in project.json.

Questions.

  1. Is it possible to use system.web from a setup like this?

  2. How can we add dependency to system.web so System.Web.FormsAuthentication is available from ASP.NET MVC 6. (Controllers/ http module)

Best Answer

Using the System.Web dll isn't the same as using System.Web. None of the System.Web pipeline will run for your ASP.NET Core application so you can't do what you are trying to do.

Related Topic