Get Current User after SignInStatus.Success

2019-08-15 13:55发布

问题:

I have a mvc app and I´m using Asp Identity 2.0. I need to change some User information after the login, so I need to get the current user just after login. I´m using the following code

       var user = UserManager.FindById(User.Identity.GetUserId());

Just after

       case SignInStatus.Success:

But I´m getting null as result. Usually when I use UserManager.FindById(User.Identity.GetUserId()) in the Controllers it works fine. Don´t know what is happening now.