【发布时间】:2022-01-09 02:28:21
【问题描述】:
在我的 Asp.Net MVC 应用程序中,我最近集成了 Azure AD 身份验证。登录工作正常,但我无法正确注销。我只想从我的应用程序中注销用户,而不是“单点注销”。我读过的所有内容都是关于单点注销的。这是我尝试过的:
-
放弃会话并重定向到登录页面。在 Html.AntiForgeryToken() 语句的登录页面上抛出与缺少声明相关的错误
Session.Abandon(); return RedirectToAction("Index", "Login"); -
这与 #1 有相同的错误
FederatedAuthentication.SessionAuthenticationModule.SignOut(); FederatedAuthentication.SessionAuthenticationModule.DeleteSessionTokenCookie(); return RedirectToAction("Index", "Login"); -
这需要用户单点退出
HttpContext.GetOwinContext().Authentication.SignOut(OpenIdConnectAuthenticationDefaults.AuthenticationType, CookieAuthenticationDefaults.AuthenticationType);
【问题讨论】:
-
你好@Apeksha,有什么更新吗?!?如果提供的解决方案有效,您能否接受它作为帮助其他社区成员解决类似问题的答案。
标签: asp.net-mvc azure-ad-b2c logout