名称'Request'在独立类的当前上下文中不存在



我尝试使用以下代码来初始化应用程序管理器

public static ApplicationUserManager UserManager
{
get
{
return _userManager ?? Request.GetOwinContext().GetUserManager<ApplicationUserManager>();
}
private set
{
_userManager = value;
}
}

但不幸的是,我得到一个错误说The name 'Request' does not exist in the current contextPS:我正在一个独立的类中初始化这个应用程序管理器。

HttpContext.Current.Request

这是你要找的吗?

最新更新