diff --git a/src/OpenIddict.Abstractions/Primitives/OpenIddictMessage.cs b/src/OpenIddict.Abstractions/Primitives/OpenIddictMessage.cs
index 07ebc16d..cd5ff4be 100644
--- a/src/OpenIddict.Abstractions/Primitives/OpenIddictMessage.cs
+++ b/src/OpenIddict.Abstractions/Primitives/OpenIddictMessage.cs
@@ -174,6 +174,11 @@ namespace OpenIddict.Abstractions
set => SetParameter(name, value);
}
+ ///
+ /// Gets the number of parameters contained in the current message.
+ ///
+ public int Count => Parameters.Count;
+
///
/// Gets the dictionary containing the parameters.
///
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs
index a1f2fc90..7182e08f 100644
--- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs
+++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Authentication.cs
@@ -200,7 +200,7 @@ namespace OpenIddict.Server.AspNetCore
// Don't cache the request if the request doesn't include any parameter.
// If a request_id parameter can be found in the authorization request,
// ignore the following logic to prevent an infinite redirect loop.
- if (context.Request.GetParameters().IsEmpty || !string.IsNullOrEmpty(context.Request.RequestId))
+ if (context.Request.Count == 0 || !string.IsNullOrEmpty(context.Request.RequestId))
{
return;
}
diff --git a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs
index 18913a36..e981defd 100644
--- a/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs
+++ b/src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlers.Session.cs
@@ -198,7 +198,7 @@ namespace OpenIddict.Server.AspNetCore
// Don't cache the request if the request doesn't include any parameter.
// If a request_id parameter can be found in the logout request,
// ignore the following logic to prevent an infinite redirect loop.
- if (context.Request.GetParameters().IsEmpty || !string.IsNullOrEmpty(context.Request.RequestId))
+ if (context.Request.Count == 0 || !string.IsNullOrEmpty(context.Request.RequestId))
{
return;
}
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs
index 8197f584..6e19c14e 100644
--- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs
+++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Authentication.cs
@@ -197,7 +197,7 @@ namespace OpenIddict.Server.Owin
// Don't cache the request if the request doesn't include any parameter.
// If a request_id parameter can be found in the authorization request,
// ignore the following logic to prevent an infinite redirect loop.
- if (context.Request.GetParameters().IsEmpty || !string.IsNullOrEmpty(context.Request.RequestId))
+ if (context.Request.Count == 0 || !string.IsNullOrEmpty(context.Request.RequestId))
{
return;
}
diff --git a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs
index 7a6e865e..accc858b 100644
--- a/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs
+++ b/src/OpenIddict.Server.Owin/OpenIddictServerOwinHandlers.Session.cs
@@ -195,7 +195,7 @@ namespace OpenIddict.Server.Owin
// Don't cache the request if the request doesn't include any parameter.
// If a request_id parameter can be found in the logout request,
// ignore the following logic to prevent an infinite redirect loop.
- if (context.Request.GetParameters().IsEmpty || !string.IsNullOrEmpty(context.Request.RequestId))
+ if (context.Request.Count == 0 || !string.IsNullOrEmpty(context.Request.RequestId))
{
return;
}