System.Web
adapters for ASP.NET CoreThis project provides a collection of adapters that help migrating from System.Web.dll
based ASP.NET projects to ASP.NET Core projects. The adapters currently include:
Microsoft.AspNetCore.SystemWebAdapters
: Subset of the APIs from System.Web.dll
backed by Microsoft.AspNetCore.Http
typesMicrosoft.AspNetCore.SystemWebAdapters.CoreServices
: Support for adding services to ASP.NET Core applications to enable migration effortsMicrosoft.AspNetCore.SystemWebAdapters.FrameworkServices
: Support for adding services to ASP.NET Framework applications to enable migration effortsMicrosoft.AspNetCore.SystemWebAdapters.Abstractions
: A collection of abstractions shared between the ASP.NET Core and .NET Framework implementations, such as session serialization interfaces.These adapters help enable large scale, incremental migration from ASP.NET to ASP.NET Core. For more details on incremental migration from ASP.NET to ASP.NET Core, see Incremental ASP.NET to ASP.NET Core Migration.
Use the Get started with incremental ASP.NET to ASP.NET Core migration guide in the docs to start using the System.Web
adapters as part of an incremental migration from ASP.NET to ASP.NET Core.
The following steps are needed to use the System.Web
adapters with an ASP.NET project:
NuGet.config
to point to the CI feed:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key=".NET Libraries Daily" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json" />
</packageSources>
</configuration>
Microsoft.AspNetCore.SystemWebAdapters
to supporting libraries
Microsoft.AspNetCore.SystemWebAdapters.CoreServices
to your ASP.NET Core applicationMicrosoft.AspNetCore.SystemWebAdapters.FrameworkServices
to your ASP.NET Framework application
web.config
. This module handles any customizations that are required to help migrate to .NET Core.builder.Services.AddSystemWebAdapters();
app.UseSystemWebAdapters();
HttpContext
. This will provide the following:
HttpContext
and System.Web
adapter HttpContext
(with appropriate caching so it will not cause perf hits for GC allocations)Microsoft.AspNetCore.Http.HttpContext
HttpContext
and on framework there are already other constructors. However, this will allow class libraries to target .NET Standard instead of needing to multi-target which will then require everything it depends on to multi-target.System.Web
so that they can be unified and enable libraries built against .NET Standard 2.0 to run on .NET Framework instances.Below are some of the limitations of the APIs in the adapters. These are usually due to building off of types used in ASP.NET Core that cannot fully implement the shape of the API in ASP.NET Framework. In the future, analyzers may be used to flag usage to recommend better patterns.
System.Web.HttpContext
are exposed as NameValueCollection
instances. In order to reduce copying, many of these are implemented on ASP.NET Core using the core containers. This makes it so that for many of these collections, Get(int)
(and any API that requires that such as .Keys
or .GetEnumerator()
) are unavailable as most of the containers in ASP.NET Core (such as IHeaderDictionary
) does not have the ability to index by position.Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.
See CONTRIBUTING.md
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
See CODE-OF-CONDUCT