diff options
-rw-r--r-- | src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs b/src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs index 5b6426dc5e..6284eea15d 100644 --- a/src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs +++ b/src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs @@ -47,7 +47,7 @@ namespace Microsoft.AspNetCore.Authorization var endpoint = context.GetEndpoint(); // Workaround for https://github.com/aspnet/AspNetCore/issues/7011. Do not use the AuthorizationMiddleware for Razor Pages - 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")) { await _next(context); return; |