diff --git a/src/IdentityServer4/Services/DefaultUserSession.cs b/src/IdentityServer4/Services/DefaultUserSession.cs index 321ce018ea..678a59ed17 100644 --- a/src/IdentityServer4/Services/DefaultUserSession.cs +++ b/src/IdentityServer4/Services/DefaultUserSession.cs @@ -255,12 +255,15 @@ private string GetSessionIdCookieValue() private void IssueSessionIdCookie(string sid) { - if (GetSessionIdCookieValue() != sid) + if (Options.Endpoints.EnableCheckSessionEndpoint) { - HttpContext.Response.Cookies.Append( - Options.Authentication.CheckSessionCookieName, - sid, - CreateSessionIdCookieOptions()); + if (GetSessionIdCookieValue() != sid) + { + HttpContext.Response.Cookies.Append( + Options.Authentication.CheckSessionCookieName, + sid, + CreateSessionIdCookieOptions()); + } } }