1

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();

gvivetapl
  • 445
  • 1
  • 5
  • 15
  • Have you got `using System.Net.Http;` in the ApiController class? – Ashley Medway Sep 15 '16 at 08:11
  • Have you also installed NuGet Package `Microsoft.Owin.Host.SystemWeb`? – Ashley Medway Sep 15 '16 at 08:13
  • Yes I have it. using System.Net.Http; and Nuget also It's a mvc project and web API. – gvivetapl Sep 15 '16 at 08:14
  • what does it mean then "I have no access" ? Null ref? Compilation error or what? – Konstantin Ershov Sep 15 '16 at 09:25
  • Request.GetOwinContext() => System.Net.http.httpRequestMessage does not contain a definition for 'GetOwinContext' and no extension method 'GetOwinContext' accepting a first argument of type 'System.Net.Http.httpRequestMessage' could be found (are you missing a using directive or an assembly reference?) – gvivetapl Sep 15 '16 at 09:39
  • Possible duplicate of [Can't get UserManager from OwinContext in apicontroller](http://stackoverflow.com/questions/24001245/cant-get-usermanager-from-owincontext-in-apicontroller) – Konstantin Ershov Sep 15 '16 at 10:26

1 Answers1

1

I've already solved, were missing from usings;

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

thank you everyone.

gvivetapl
  • 445
  • 1
  • 5
  • 15