User.Identity.GetUserId() returns null after successful login

后端 未结 9 2532
傲寒
傲寒 2020-12-05 09:52

I\'ve defined a temp variable to get current user id, it always returns null.

Here is the snapshot:

Why?

UPDATE:

         


        
9条回答
  •  执笔经年
    2020-12-05 10:17

    Simply try this :

    string userId = SignInManager
    .AuthenticationManager
    .AuthenticationResponseGrant.Identity.GetUserId();
    

提交回复
热议问题