You can access GetOwinContext ().GetUserManager fr

2019-06-08 09:03发布

问题:

I'm doing a project in a api, and I need to access from the ApiController class to:

var result = await SignInManager.PasswordSignInAsync (model.UserName,model.Password...

but I have access neither
HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>() nor

Request.GetOwinContext().GetUserManager<ApplicationUserManager>();

Basically I need to check that the username and password are correct.

EDIT: I have reference to microsoft.owin.host.SystemWeb and in ConfigureAuth app.CreatePerOwinContext();

回答1:

I've already solved, were missing from usings;

using System.Net.Http;
using Microsoft.AspNet.Identity.Owin;

thank you everyone.