Skip to content

Middleware article overhaul#36616

Open
guardrex wants to merge 15 commits intomainfrom
guardrex/middleware-overhaul
Open

Middleware article overhaul#36616
guardrex wants to merge 15 commits intomainfrom
guardrex/middleware-overhaul

Conversation

@guardrex
Copy link
Collaborator

@guardrex guardrex commented Jan 13, 2026

Fixes #35805

I performed a general pass as I seek to make it Blazor friendly.

There's one question that I have in here of a technical nature: For Use delegate overload that passes the HttpContext to next for performance, why aren't we pitching that overload in all general use cases if it provides a perf improvement? Looking at it another way, what are the caveats/gotchas 😈 that we can state in the section for when it shouldn't be called?

Do you want to continue with the INCLUDES file versioning approach? 👂 If not, I'll roll the 3-7 file in here by section with versioning to get it down to one file (and no broken links in prior release content).

I'll remove the inline reviewer comments after we're done with reviews before merging.


Internal previews

Toggle expand/collapse
📄 File 🔗 Preview link
aspnetcore/blazor/host-and-deploy/app-base-path.md aspnetcore/blazor/host-and-deploy/app-base-path
aspnetcore/data/ef-rp/update-related-data.md aspnetcore/data/ef-rp/update-related-data
aspnetcore/fundamentals/app-state.md aspnetcore/fundamentals/app-state
aspnetcore/fundamentals/http-requests.md aspnetcore/fundamentals/http-requests
aspnetcore/fundamentals/middleware/index.md aspnetcore/fundamentals/middleware/index
aspnetcore/fundamentals/middleware/request-response.md aspnetcore/fundamentals/middleware/request-response
aspnetcore/grpc/aspnetcore.md aspnetcore/grpc/aspnetcore
aspnetcore/grpc/basics.md aspnetcore/grpc/basics
aspnetcore/host-and-deploy/linux-nginx.md aspnetcore/host-and-deploy/linux-nginx
aspnetcore/host-and-deploy/proxy-load-balancer.md aspnetcore/host-and-deploy/proxy-load-balancer
aspnetcore/mvc/advanced/custom-model-binding.md aspnetcore/mvc/advanced/custom-model-binding
aspnetcore/mvc/controllers/filters.md aspnetcore/mvc/controllers/filters
aspnetcore/performance/response-compression.md aspnetcore/performance/response-compression
aspnetcore/security/authentication/cookie.md aspnetcore/security/authentication/cookie
aspnetcore/security/data-protection/implementation/key-management.md aspnetcore/security/data-protection/implementation/key-management
aspnetcore/security/data-protection/implementation/key-storage-providers.md aspnetcore/security/data-protection/implementation/key-storage-providers
aspnetcore/signalr/authn-and-authz.md aspnetcore/signalr/authn-and-authz

@guardrex guardrex self-assigned this Jan 13, 2026
@guardrex guardrex marked this pull request as ready for review January 20, 2026 12:34
@guardrex guardrex requested a review from Copilot January 20, 2026 12:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR performs a comprehensive overhaul of the middleware article and related documentation to make it more Blazor-friendly. The changes include removing obsolete include files, updating cross-references, deleting old snapshot code files, adding a new SVG diagram, and inlining code samples that were previously in separate files.

Changes:

  • Removes code-comments-loc.md and ForwardedHeaders.md include files and replaces their usage with inline content
  • Deletes multiple snapshot code files and mermaid diagram files that are no longer needed
  • Adds new filter-pipeline-3.svg diagram for the filters article
  • Updates cross-reference links to use consistent fragment identifiers (e.g., #middleware-order instead of #order)
  • Inlines code samples throughout the middleware article for better maintainability

Reviewed changes

Copilot reviewed 53 out of 55 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
aspnetcore/includes/code-comments-loc.md Deleted include file for code comments localization notice
aspnetcore/includes/ForwardedHeaders.md Deleted include file for Forwarded Headers Middleware ordering
aspnetcore/fundamentals/middleware/index/includes/*.md Deleted multiple versioned middleware article includes
aspnetcore/fundamentals/middleware/index/snapshot/*.cs Deleted snapshot code files
aspnetcore/mvc/controllers/filters/_static/filter-pipeline-3.svg Added new SVG diagram showing filter pipeline
aspnetcore/fundamentals/middleware/index/includes/index3-7.md Inlined code samples and removed include references
Multiple .md files Updated xref links and removed include file references

@guardrex guardrex requested a review from tdykstra January 20, 2026 12:49
@guardrex
Copy link
Collaborator Author

guardrex commented Jan 22, 2026

@BrennanConroy ... Hi and Happy New Year! 🥳 ...

Could you answer a question for me about what Rick added to the Middleware article at ...

Prefer app.Use overload that requires passing the context to next

... relative to the discussion on ...

dotnet/aspnetcore#31463

The current article section is guiding devs to the overload almost as an afterthought, but it looks like you intend to recommend it over the earlier non-context-passed overload, except in the case of terminal middleware when Run should be used (warning devs off of Use without next via the analyzer).

If that's correct, I'll make the updates on this PR, which is an overhaul of the whole article. This has come up here because we're in the process of Blazorfying™ 😄 the main doc set's Fundamentals articles, and I noticed this potential problem in passing.

If I'm headed in the right direction, is it best to keep both overloads, describing and recommending the new overload first (are there gotchas 😈 where the prior overload is best)? Alternatively, would it be better to not describe the earlier (non-context-passed) overload at all and only cover the context-passed one? [Note that the content I'm directly addressing is >=8.0, but I will go back and make updates to 6.0 and 7.0 coverage on this subject.]

cc: @danroth27

@BrennanConroy
Copy link
Member

We should probably promote it as the only Use overload you should use. Don't think we even need to mention the other one.

@guardrex
Copy link
Collaborator Author

Thanks, @BrennanConroy ... Will do. 👍

@guardrex
Copy link
Collaborator Author

guardrex commented Jan 23, 2026

@tdykstra ... It's ready for review now. 🎉

... AND ....

Let me know if you want me to get rid of the .NET 3 to 7 INCLUDES file and roll the content into each section with versioning in one markdown file for no broken bookmarks in prior release content and a lot less duplicate content. I can work it out if you want, and we can pick back up on Monday with the review.

@tdykstra
Copy link
Contributor

@guardrex:

Let me know if you want me to get rid of the .NET 3 to 7 INCLUDES file and roll the content into each section with versioning in one markdown file for no broken bookmarks in prior release content and a lot less duplicate content. I can work it out if you want, and we can pick back up on Monday with the review.

We adopted the include files for different versions because when everything was in one file people tend to overlook the prior versions when editing an article. Maybe a warning in a comment near the top of the file would address that. Thoughts?

@guardrex
Copy link
Collaborator Author

I understand what you mean about readers not scrolling to the bottom to edit other entire-article versioned markdown; but to avoid the broken bookmark problem and not have duplicate headings, I set up versioned content entirely within sections. There are no duplicate sections (heading ids to be specific) in the Blazor node, minimal duplicated content, no broken bookmark links to prior version content, and no need to scroll to other whole-article content areas at the bottom of a markdown file (or a different file) when maintaining content.

The downside is version-tag flipping a bit here and there, which we've seen become very painful at times (e.g., the Kestrel article several years ago prior to adopting the INCLUDES file approach there). Fortunately, it's only been a minor problem in a few Blazor articles ... it's been manageable thus far.

If you want to keep the current setup, the PR is ready for final review. I would just need to add the commented remark at the top of the file. However, that sounds like something that the team might do separately and uniformly. This is but one of several dozen articles that would receive such remarks.

@guardrex
Copy link
Collaborator Author

@tdykstra ... Did you decide what you want to do with the INCLUDES file on this one? I'm working on the Options article overhaul, and I discovered that it will be fairly easy on that one to drop the INCLUDES file, so I'm doing that and will have that PR up perhaps on Monday. Anyway ... do you know if you want to keep it for the Middleware article? I'm not sure if it would be easy or hard to do, but I can try 😄.

Also, do you want to have a separate issue and PR to apply a global remark to the articles that will continue to use INCLUDES files? It seems like such a remark wouldn't be added to just one article like this in an ad hoc fashion (if this one ends up keeping its INCLUDES file).

@tdykstra
Copy link
Contributor

Did you decide what you want to do with the INCLUDES file on this one? ... if you want to keep it for the Middleware article? I'm not sure if it would be easy or hard to do, but I can try

Go ahead and try

Also, do you want to have a separate issue and PR to apply a global remark to the articles that will continue to use INCLUDES files?.

Sounds good.

@guardrex
Copy link
Collaborator Author

guardrex commented Feb 4, 2026

@tdykstra ... Lick'd IT! 🐮👅 ......

I was able to drop the INCLUDES file ...

  • The introductory content only required two versioning blocks for the changes at 6.0.
  • I retained the Middleware order section for each release because there were several changes in that section.
  • I tell readers that the built-in middleware is for the latest release.

This is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update "ASP.NET Core Middleware" to remove unrelated MVC & Razor Pages content and focus instead on Blazor

3 participants