SignOutAsync无法在ASP.NET Core 2.1中用于Microsoft身份验证

时间:2019-05-16 13:03:16

标签: c# authentication asp.net-core asp.net-core-mvc asp.net-core-identity

我已经使用Microsoft身份验证创建了ASP.NET Core MVC应用程序。在这里,我正在使用以下代码来注销用户帐户。

 public async Task<IActionResult> LogoutAsync()
    {
        await _signInManager.SignOutAsync();
        return RedirectToAction("Index", "Home");
    }

但是,用户帐户仍处于登录状态。什么问题?是否可以完全注销包括Microsoft网站在内的帐户。

我已经尝试过以下link中的代码

public async Task LogoutAsync()
    {
        await SignOut("Home/Index");
    }


    public async Task SignOut(string redirectUri)
    {
        await _signInManager.SignOutAsync();
        await HttpContext.SignOutAsync("Cookies");
        var prop = new AuthenticationProperties()
        {
            RedirectUri = redirectUri
        };
        await HttpContext.SignOutAsync("Microsoft", prop);
    }

它仍处于登录状态,请单击here进行检查。

0 个答案:

没有答案
相关问题