Create Auto Login function in MVC 5 Identity
New to MVC / Identity
I am trying to create a function that will automatically login a user based on some hard coded credentials.
This code is called when a page is loaded and is triggered by a app setting.
That part is working ok.
The code so far (in the AccountController):
public ActionResult AutoLogin()
var account = new AccountController();
TCDec2019.Models.LoginViewModel mdl = new LoginViewModel();
mdl.Email = "firstname.lastname@example.org";
mdl.Password = "Abc#1def";
mdl.RememberMe = false;
var result = Login(mdl, null); //executes the standard login function
The code works until I call the standard Login function in the Accounts Controller using the mdl model created with the code.
The line in the Login task giving the problem is:
var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
the result is set by calling ApplicationSignInManager in the AccountController
This call returns an Exception System.NulReference.
If I use the standard login function, which calls the same ApplicationSignManager it returns
So, my question is what do I need to set so that calling the ApplicationSigninManager will return the correct value.
Thanks in advance.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)