带有Duende IdentityServer的ASP.NET核心 - 如何清除cookie

发布于 2025-02-08 10:00:22 字数 388 浏览 2 评论 0原文

我使用duende IdentityServer进行身份验证的ASP.NET Core MVC应用程序,并且具有一旦用户进行认证,它也会启动Angular Spa。

用户注销后,我试图清除服务器端的cookie。

foreach (var cookie in Request.Cookies.Keys)
{
       Response.Cookies.Delete(cookie);
}

但是,如果另一个用户在同一选项卡或其他选项卡甚至新的浏览器会话中再次登录,则以前的用户数据仍在应用程序使用的会话cookie中。 我必须先到期饼干吗? 当我检查请求时,我仍然在其中看到它们,因此打开新选项卡或启动新的浏览器时,是从服务器发送回的cookie吗? 以前的用户注销时不会删除它们?

I have an ASP.NET Core MVC Application using Duende IdentityServer for authentication and also have an Angular SPA that is launched once a user is authenticated.

After user logs out I am trying to clear cookies as follows on the server side.

foreach (var cookie in Request.Cookies.Keys)
{
       Response.Cookies.Delete(cookie);
}

However if another user logs in again on the same tab or another tab or even a new browser session, previous users data is still in the session cookie that the application uses.
Do I have to expire the cookie first.
When I check the Request.Cookies I still see them in there so when a new tab is opened or a new browser is started is the cookies sent back from the Server?
Will they not be removed when the previous user logs out?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文