加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 缺少AuthenticationManager引用

发布时间:2020-12-15 20:36:24 所属栏目:asp.Net 来源:网络整理
导读:跟进 this问题后,缺少SignOut()和SignIn()方法的引用: private async Task SignInAsync(User user,bool isPersistent){ AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); var identity = await UserManager.CreateIdentityAsync
跟进 this问题后,缺少SignOut()和SignIn()方法的引用:
private async Task SignInAsync(User user,bool isPersistent)
{
    AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
    var identity = await UserManager.CreateIdentityAsync(user,DefaultAuthenticationTypes.ApplicationCookie);
    AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent },identity);
}

有人知道如何解决它吗?

解决方法

您是如何定义AuthenticationManager属性的?通常它应该如下所示:
private IAuthenticationManager AuthenticationManager
{
  get
  {
    return HttpContext.GetOwinContext().Authentication;
  }
}

有了它,您应该能够调用SignOut和SignIn方法.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读