![](/img/trans.png)
[英]How to show the name of the logged user in the Page in ASP MVC without EF
[英]How to reference the current user logged in MVC 4 EF
我想知道是否要让当前用户登录(包括所有要存储在会话中的属性)(登录时)将是一个好主意。
SimpleMembership已剩下很多库存。 我如何调用用户对象以从UserProfile
表中获取。
我没有看到Login控制器创建一个UserProfile
对象来存储当前用户。 EF api是否有任何灵巧的方法可以做到这一点?
using Microsoft.AspNet.Identity;
...
User.Identity.Name
User.Identity.IsAuthenticated
我认为这会帮助您!
这就是我们获取用户对象并遍历其属性的方式
using (var ctx = new UsersContext())
{
ctx.UserProfiles.Find(userID).ALL-ATTRIBUTES-HERE;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.