A collection of adapters that help with migrating from System.Web.dll based ASP.NET projects to ASP.NET Core projects by providing implementations of common System.Web APIs for use in ASP.NET Core apps.
$ dotnet add package Microsoft.AspNetCore.SystemWebAdaptersProvides System.Web compatibility APIs for ASP.NET Core applications, enabling incremental migration from ASP.NET Framework. Use familiar types like HttpContext, HttpRequest, HttpResponse, and more in your ASP.NET Core apps and .NET Standard libraries.
Configure in your ASP.NET Core Program.cs:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSystemWebAdapters();
var app = builder.Build();
app.UseSystemWebAdapters();
app.Run();
Use System.Web types in your ASP.NET Core application:
using System.Web;
var context = HttpContext.Current;
var userAgent = context.Request.UserAgent;
var ipAddress = context.Request.UserHostAddress;
// Access session and cache
context.Session?["Key"] = "Value";
context.Cache["CacheKey"] = "CacheValue";
Supported APIs: HttpContext, HttpRequest, HttpResponse, HttpSessionState, Cache, HttpServerUtility, IHttpHandler, IHttpModule, and more.