Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
I have this method and i am getting this error to this object, please assist me.

What I have tried:

public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
       {
           if (User.Identity.IsAuthenticated)
           {
               return RedirectToAction("Manage");
           }

           if (ModelState.IsValid)
           {
               // Get the information about the user from the external login provider
               var info = await AuthenticationManager.GetExternalLoginInfoAsync();// this is error line AIAuthenticationManager does not contain a definition for GetExternalLoginInfoAsync()
               if (info == null)
               {
                   return View("ExternalLoginFailure");
               }
               var user = new ApplicationUser() { UserName = model.UserName };
               var result = await UserManager.CreateAsync(user);
               if (result.Succeeded)
               {
                   result = await UserManager.AddLoginAsync(user.Id, info.Login);
                   if (result.Succeeded)
                   {
                       await SignInAsync(user, isPersistent: false);
                       return RedirectToLocal(returnUrl);
                   }
               }
               AddErrors(result);
           }

           ViewBag.ReturnUrl = returnUrl;
           return View(model);
       }

private IAuthenticationManager AuthenticationManager
     {
         get
         {
             return HttpContext.GetOwinContext().Authentication;// HttpContext does not contain definition of GetOwninContext line of error
         }
     }
Posted
Updated 4-Feb-20 3:10am
Comments
jimmson 4-Feb-20 4:53am    
Have you ever tried to google your question/problem?
https://www.google.com/search?client=firefox-b-d&q=HttpContext+does+not+contain+definition+of+GetOwninContext
gcogco10 4-Feb-20 5:53am    
@jimmson I ended up fixing the issue, I was not installing the correct assembly to my project. Therefore I have ran this Package manager console Install-Package Microsoft.AspNet.Identity.Owin. It was gone the error.
jimmson 4-Feb-20 6:30am    
That's good news! So maybe you can delete this question, or answer it by yourself, so other people don't need to waste the time with answering?
Richard Deeming 4-Feb-20 8:18am    
Which is exactly the same problem and solution that you posted yesterday!
Getexternallogininfoasync error method, how to fix it?[^]

1 solution

Install-Package
Microsoft.AspNet.Identity.Owin  on Package Manager Console on your Visual Studio, the error will be gone. Its a missing namespace.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900