【发布时间】:2015-07-28 14:47:41
【问题描述】:
在我的 ASP.NET vNext beta4 下的 AccountController 中,我们使用以下方式注销:
Context.Response.SignOut(OpenIdConnectAuthenticationDefaults.AuthenticationScheme);
Context.Response.SignOut(CookieAuthenticationDefaults.AuthenticationType);
效果很好,用户最终进入了 Office 365 的登录页面,正如我们预期的那样。
更新到 beta6 后,SignOut 方法显示为错误。我们将其替换为以下内容,但注销似乎从未正确发生。用户立即被扔回登录的主页。我已经尝试过 SignOutAsync 和 ForbidAsync ,甚至两者都一起尝试过,但自更新后仍然无法注销用户。
var properties = new AuthenticationProperties
{
AllowRefresh = false,
ExpiresUtc = DateTime.UtcNow.AddDays(-1),
IsPersistent = true,
RedirectUri = "/",
IssuedUtc = DateTime.UtcNow
};
await Context.Authentication.SignOutAsync(OpenIdConnectAuthenticationDefaults.AuthenticationScheme, properties);
await Context.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationType, properties);
在 beta6 中正确注销用户并将他们重定向到 Office 365 登录屏幕的推荐(或任何)方法是什么?
【问题讨论】:
-
请使用
{ }按钮(或四个空格)格式化代码块。仅将 ` 用于内联代码。 -
您是如何进行登录的?
标签: c# asp.net-mvc asp.net-core asp.net-core-mvc