示例#1
0
     public async Task<IHttpActionResult> CheckLoginUserPassword(string email,string password)
     {
         ApplicationDbContext ctx = new ApplicationDbContext();
         UserStore<ApplicationUser> store = new UserStore<ApplicationUser>(ctx);
         UserManager<ApplicationUser> UserManager = new UserManager<ApplicationUser>(store);
         password = UserManager.PasswordHasher.HashPassword(password);  
         //var ret = await db.AspNetUsers.FirstOrDefaultAsync(x => x.UserName.Equals(email) && x.PasswordHash.Equals(password));
         var user = await UserManager.FindAsync(email,password);
         if (user != null)
         {
             //await HttpContext
            // await HttpContext.GetOwinContext()
 //.Get<ApplicationSignInManager>().SignInAsync(user, true, false); 
        //    await  SignInAsync(user, true,true); 
             return Ok("Incorrect");
         }
         return Ok("Ok");
     }