简体   繁体   English

ASP.net Linq登录用户以过滤linq查询

[英]ASP.net Linq getting logged in user to filter a linq query

Hi I am using sqlMembershipProvider and I tried to get at the user object to filter a linq query. 嗨,我正在使用sqlMembershipProvider,我试图获取用户对象以过滤linq查询。 But i cant seem to find the UserID in this object. 但我似乎无法在此对象中找到UserID。

here's my code: 这是我的代码:

var query =  (from b in db.Builders where b.UserID==b.UserID????ID select b).ToList();

the user is associated with the request, so you can pull the username from there 用户与请求相关联,因此您可以从那里拉用户名

HttpContext.Current.User.Identity.Name;

If you can reference the current context without using the static gateway HttpContext.Current, that would be event better. 如果您可以在不使用静态网关HttpContext.Current的情况下引用当前上下文,那将更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM