I have a standard MVC project with UserManager and SignInManager and AccountController objects with pre-created functionality such as login and registration.
I can register new users in my AspNetUsers table, but when I log in, I call: -
var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
The data comes from the form correctly, and the result is the success that I expected.
Then I tried the following redirects: -
case SignInStatus.Success: //return RedirectToLocal("/admin/"); return RedirectToAction("Index", "Admin");
but on any page after this successful login, User.Identity.IsAuthenticated is always false, and User.Identity.Name is an empty string.
What am I doing wrong? I did another project in the same way with the same setup in the past, and I had problems with null.
web.config
<system.web> <compilation debug="true" targetFramework="4.5.1" /> <httpRuntime targetFramework="4.5.1" /> <authentication mode="None" /> </system.web> <modules> <remove name="FormsAuthentication" /> </modules>
Can anyone suggest what I'm doing wrong? This is causing serious problems now.
Hooray!
source share