Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在ASP.NET identity中以密码登录时获取身份_C#_Asp.net_Asp.net Identity_Asp.net Identity 2 - Fatal编程技术网

C# 如何在ASP.NET identity中以密码登录时获取身份

C# 如何在ASP.NET identity中以密码登录时获取身份,c#,asp.net,asp.net-identity,asp.net-identity-2,C#,Asp.net,Asp.net Identity,Asp.net Identity 2,我正在使用ASP.NET标识和下面的代码登录用户 SignInStatus result = await SignInManager.PasswordSignInAsync(model.EmployeeNo, model.Password, model.RememberMe, shouldLockout: false); 它工作正常,用户已成功登录。但是当我像下面这样检查用户身份时 HttpContext.GetOwinContext().Authentication.User.Identit

我正在使用ASP.NET标识和下面的代码登录用户

SignInStatus result = await SignInManager.PasswordSignInAsync(model.EmployeeNo, model.Password, model.RememberMe, shouldLockout: false);
它工作正常,用户已成功登录。但是当我像下面这样检查用户身份时

HttpContext.GetOwinContext().Authentication.User.Identity

里面没有数据吗?如何在密码登录成功后立即检索用户的身份?

明白了。要得到它,只需使用下面的代码

HttpContext.GetOwinContext().Authentication.AuthenticationResponseGrant.Identity