Skip to content

Instantly share code, notes, and snippets.

@AnthonyGiretti
Created November 24, 2025 01:05
Show Gist options
  • Select an option

  • Save AnthonyGiretti/954ef7b7d85703feebc098f9b7b56fe8 to your computer and use it in GitHub Desktop.

Select an option

Save AnthonyGiretti/954ef7b7d85703feebc098f9b7b56fe8 to your computer and use it in GitHub Desktop.
ASP.NET Core 10: Clearer Separation Between Middlewares and Endpoints for More Predictable Routing
// Before ASP.NET Core 10
// Order matters
app.UseAuthentication();
app.UseRouting();
app.UseAuthorization(); // This might run before endpoint metadata is fully known
app.MapControllers();
// With ASP.NET Core 10
// Order does not matter
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment