开发者

asp.net membership provider get UserName by UserId

I have seen a lot of question asking about known user name and how to retrieve U开发者_如何学JAVAserId accordingly. How about the other way around?

For some reason I have UserId, but I don't want to include aspnet_User table into my data entities. Is there any way I can retrieve the user name without querying against aspnet_User table?


MembershipUser user = Membership.GetUser();
if (user != null)
    string name = user.UserName;

Internally, this will access the ASP.NET user table. There's no way to avoid that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜