Add API to System.Web adapters to enable explicitly mapping Blazor pages
See original GitHub issueBackground and Motivation
We created a set of adapters and guidance (https://github.com/dotnet/systemweb-adapters) to simplify the migration process from ASP.NET to ASP.NET Core. As part of this, we have recommended people set up a ASP.NET Core application that will attempt to serve requests and fallback to the original ASP.NET framework application via YARP. This works well for many things, but it fails when trying to use Blazor. This is because currently both Blazor and YARP are fallback endpoints and this conflicts with each other.
See https://github.com/dotnet/aspnetcore/issues/42003 for an existing issue on dotnet/aspnetcore that is tracking the need for this.
Proposed API
For the dotnet/systemweb-adapters, I have implemented an extension method that will accomplish this need. However, as this is a feature planned for .NET 8, I want to ensure we have identified a few things:
- The API in the web adapters should be useable for .NET 6 and .NET 7, but provide a way to migrate to the official .NET 8 API
- We don’t want to conflict with the API design for .NET 8
Here is the public API for this that we are currently exposing on the Microsoft.AspNetCore.SystemWebAdapters package:
namespace Microsoft.AspNetCore.Builder;
public static class BlazorEndpointRouteBuilderExtensions
{
+ public static IEndpointConventionBuilder MapBlazorPages(this IEndpointRouteBuilder endpoints, string page);
+ public static IEndpointConventionBuilder MapBlazorPages(this IEndpointRouteBuilder endpoints, string page, params Assembly[] assemblies)
}
Usage Examples
An example usage would be:
app.MapBlazorHub();
// This is the default way to set up Blazor pages
//app.MapFallbackToPage("/_Host");
// Proposed API
app.MapBlazorPages("/_Host");
app.MapReverseProxy();
Risks
- How do we prevent this API from conflicting with an API for .NET 8 that will accomplish a similar thing but still available for down level?
Issue Analytics
- State:
- Created 8 months ago
- Reactions:1
- Comments:11 (11 by maintainers)

Top Related StackOverflow Question
@davidfowl, @twsouthwick it’s not clear whether there is still any work you need from Blazor as part of this issue or not? If not, can you please close this? Thanks!
@davidfowl agree it should be in .NET 8. I chatted with @javiercn and he is planning on doing that and I’m assuming will drive any API changes