你可以从ApiController类访问GetOwinContext()。GetUserManager吗?
我在api中做一个项目,我需要从ApiController类访问:
var result = await SignInManager.PasswordSignInAsync (model.UserName,model.Password...
但我也没有访问权限
HttpContext.Current.GetOwinContext().GetUserManager()
nor
Request.GetOwinContext().GetUserManager();
基本上我需要检查用户名和密码是否正确。
编辑:我参考了microsoft.owin.host.SystemWeb和ConfigureAuth app.CreatePerOwinContext();
我已经解决了,从使用中遗失了;
using System.Net.Http; using Microsoft.AspNet.Identity.Owin;
谢谢大家。