dotnet / dotnet/AspNetCore.Docs

Since IMiddleware exists, the "Write custom ASP.NET Core middleware" page should switch to using it.

Open
#34,730 1 comment 0 reactions 1 assignee Claimed by @mitchdenny View on GitHub
aspnet-core/svc fundamentals/subsvc Source - Docs.ms
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

### Description

[This page](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/write?view=aspnetcore-9.0) describes methods of creation custom middlewares using the old, non-interfaced way, where you should either memorize or constantly check up with the docs of whether you've managed to guess the correct signature of both the `InvokeAsync` method AND the `RequestDelegate` parameter of the constructor.

The [`IMiddleware`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.imiddleware) was there since .NET Core 2.0 and I believe the need to nudge the developers to start using it is long overdue.

### Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/write?view=aspnetcore-9.0

### Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/middleware/write.md

### Document ID

cd22a135-4446-79f5-89db-b741bd44a720

### Article author

@Rick-Anderson

### Metadata

* ID: 13e2d968-17a6-1a50-53cd-1d6b9ad0276d
* PlatformId: f3890656-a128-4c55-0ed2-0882f2d05c6f
* Service: **aspnet-core**
* Sub-service: **fundamentals**

[Related Issues](https://github.com/dotnet/AspNetCore.Docs/issues?q=is%3Aissue+is%3Aopen+cd22a135-4446-79f5-89db-b741bd44a720)

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.