GetOwinContext无法在asp.net核心中运行

Map*_*ory 13 c# asp.net owin asp.net-core

它总是说HttpContext不包含GetOwinContext()的定义,我尝试下载.net核心owin但我不知道如何实现相同的功能.下面的代码可以在asp.net 5中编译.

private IAuthenticationManager AuthenticationManager
{
    get
    {                
        return HttpContext.GetOwinContext().Authentication;
    }
}
Run Code Online (Sandbox Code Playgroud)

Tra*_*her 14

没有GetOwinContext()Asp.Net核心.请HttpContext.Authentication改用.

  • 我头晕目眩。如今,DotNet 已经遍布整个地图。 (4认同)
  • HttpContext.Authentication在ASP.Net Core 2.1中已过时。 (2认同)
  • 是的,它的权利是HttpContext.Authentication在ASP.NET Core 2.1+中已过时,以后将被删除。Microsoft建议改为使用AuthenticationHttpContextExtensions。 (2认同)