The goal of this project is to explore building some of the basic building blocks of the WebForms on ASP.NET Core. This will isolate out the actual components needed to build a functional page.
Supported so far:
System.Web.IHttpHandlerSystem.Web.UI.PageSystem.Web.UI.HtmlTextWriterSystem.Web.UI.HtmlControls.*System.Web.UI.WebControls.*System.Web.Routing.*- Master pages
- Compilation of
aspxpages (both VB and C#) - Binary compatibility with
System.Web.dllandSystem.Web.Extensions.dll(if the API exists) ScriptManagerand ajax supportSystem.Web.Optimization
What is NOT supported:
- Designer support
System.Webhosting modelSystem.Webmembership model- Any
System.Webconcept not called out as in scope
This will make use of Microsoft.AspNetCore.SystemWebAdapters to provide the System.Web.HttpContext that is at the core of the WebForms pipeline.
Important
The feed URL has changed as of 2 April, 2024
-
Add a
nuget.configor update yours to have 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="corewebforms" value="https://corewebformsfeed.blob.core.windows.net/feed/index.json" /> </packageSources> </configuration>
-
Create a .NET 9 project similar to the following with the WebForms SDK:
<Project Sdk="CoreWebForms.Sdk/0.2.1"> <PropertyGroup> <TargetFrameworks>net9.0</TargetFrameworks> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <!-- Optional, but easier to debug at runtime than compile time --> <EnableRuntimeAspxCompilation>true</EnableRuntimeAspxCompilation> </PropertyGroup> </Project>
-
Add WebForms to your services (this automatically will add the System.Web adapters - this can be configured independently if needed)
builder.Services.AddSystemWebAdapters() .AddPreApplicationStartMethod(false) // Used if you want to run any pre application start methods .AddJsonSessionSerializer() .AddWrappedAspNetCoreSession() .AddRouting() .AddWebForms() .AddScriptManager() // Remove if you don't use ScriptManager/AJAX .AddOptimization() // Remove if you don't use System.Web.Optimization .AddDynamicPages() // Used if you have dynamic pages .AddCompiledPages(); // Used if compiled pages are used builder.Services.AddSession(); builder.Services.AddDistributedMemoryCache();
-
Add the System.Web middleware and map endpoints:
... app.UseSession(); app.UseSystemWebAdapters(); ... app.MapHttpHandlers(); // Required for pages (or other configured handlers) app.MapScriptManager(); // Required if you want to use ScriptManager app.MapBundleTable(); // Required if you want to use BundleTable.Bundles
-
Add any
.aspxor.aspx.cs/.aspx.vbfiles to your project. They should be served up as expected when you run.
For samples, please go to the samples repo for up-to-date examples.
Please see the design docs to see the designs and plans for how this are expected to work.