We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f2ee320 commit 1aa50faCopy full SHA for 1aa50fa
src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs
@@ -47,7 +47,7 @@ public async Task Invoke(HttpContext context)
47
var endpoint = context.GetEndpoint();
48
49
// Workaround for https://github.com/aspnet/AspNetCore/issues/7011. Do not use the AuthorizationMiddleware for Razor Pages
50
- if (endpoint.Metadata.Any(m => m.GetType().FullName == "Microsoft.AspNetCore.Mvc.ApplicationModels.PageRouteMetadata"))
+ if (endpoint != null && endpoint.Metadata.Any(m => m.GetType().FullName == "Microsoft.AspNetCore.Mvc.ApplicationModels.PageRouteMetadata"))
51
{
52
await _next(context);
53
return;
0 commit comments