dotnet / dotnet/AspNetCore.Docs

UseWhen works instead of Mapwhen

Open
#10,520 2 comments 0 reactions 0 assignees View on GitHub
doc-idea RR Source - Docs.ms
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

regarding this line
```
app.MapWhen(
context => context.Request.Path.ToString().EndsWith(".report"),
appBranch => {
// ... optionally add more middleware to this branch
appBranch.UseMyHandler();
});
```

while creating a list of multiple middlewares.
`app.MapWhen` is not forwarding the request to further pipeline,
instead `app.UseWhen` is working properly

Edit by @Rick-Anderson
2.5K PV

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 60f81f11-5621-b581-69f5-60093946b8ed
* Version Independent ID: 886858c7-29eb-714a-22ff-c30973d889e1
* Content: [Migrate HTTP handlers and modules to ASP.NET Core middleware](https://docs.microsoft.com/en-us/aspnet/core/migration/http-modules?view=aspnetcore-2.2)
* Content Source: [aspnetcore/migration/http-modules.md](https://github.com/aspnet/Docs/blob/master/aspnetcore/migration/http-modules.md)
* Product: **aspnet-core**
* GitHub Login: @Rick-Anderson
* Microsoft Alias: **tdykstra**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.