在.NET Core中,HttpContext.SignOutAsync()和ControllerBase.SignOut()有什么区别?

问题描述 投票:0回答:1

我目前正在。NET Core 2.2]中为我们的WsFederation实现注销方法。我发现了这两种方法:

  1. ControllerBase.SignOut方法
  2. AuthenticationHttpContextExtensions.SignOutAsync方法
  3. 我找到了这两个答案:

  1. SignOut (LogOut) Error in AspNetCore 2.1 with WsFederation

  2. ASP.NET Core Identity 2.0 SignoutAsync is not logging out user if the user signed in with Google

  3. 我也签出了Microsoft文档:

  1. https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.controllerbase.signout?view=aspnetcore-2.2#Microsoft_AspNetCore_Mvc_ControllerBase_SignOut_System_String___

  2. https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.authentication.authenticationhttpcontextextensions.signoutasync?view=aspnetcore-2.2#Microsoft_AspNetCore_Authentication_AuthenticationHttpContextExtensions_SignOutAsync_Microsoft_AspNetCore_Http_HttpContext_

  3. 仍然没有明确的答案。

谁能告诉我有什么区别?以及应该使用哪一个从我在Startup.cs中建立的中间件中注销认证/ WsFederation。

提前感谢!

T

我目前正在.NET Core 2.2中为我们的WsFederation实现注销方法。我发现了这两种方法:ControllerBase.SignOut方法AuthenticationHttpContextExtensions.SignOutAsync ...

c# asp.net-core asp.net-core-mvc asp.net-core-2.2 ws-federation
1个回答
0
投票

source上查找SignoutResultControllerBase.Signout返回新的SignoutResult),ExecuteResultAsync调用SignOutAsync上的HttpContext。唯一的不同可能是在ControllerBase上调用它会导致正确的响应发送到客户端。

© www.soinside.com 2019 - 2024. All rights reserved.