如何从成员资格提供用户/配置文件的列表? [英] How to Get List of User/Profile from Membership Provider?

查看:124
本文介绍了如何从成员资格提供用户/配置文件的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我利用这种成员资格提供程序。我坚持让用户列表+个人资料(名字,姓氏,标题等等等等)

I am utilising this Membership Provider. I am stuck with getting the User List + Profile (FirstName, LastName, Title etc etc)

我知道,有对Membership.GetAllUsers()的方法,但我不知道如何与这个名字结合在一起,我存储在配置文件提供姓氏。

I know that there is a method for Membership.GetAllUsers() but I don't know how to combine this with FirstName, LastName that I stored in Profile Provider.

感谢

推荐答案

Membership.GetAllUsers()返回一个MembershipUserCollection,你可以用它来访问个人的MembershipUser。例如:

Membership.GetAllUsers() returns a MembershipUserCollection, which you can use to access individual MembershipUser. Example:

MembershipUserCollection users = Membership.GetAllUsers();
string email = users["some_username"].Email;

您还可以在类似的方式检索ProfileInfo:

You can also retrieve ProfileInfo in the similar way:

ProfileInfoCollection profiles = ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All);
DateTime lastActivity = profiles["some_username"].LastActivityDate;

但也有默认情况下没有名字和姓氏的属性,除非你手动在您的个人资料提供商指定它们。

However there are no FirstName and LastName properties by default, unless you manually specified them in your profile provider.

查看类的MembershipUser 以及< A HREF =htt​​p://msdn.microsoft.com/en-us/library/system.web.profile.profileinfo.aspx相对=nofollow> ProfileInfo类了解更多详情。你也可能想看看的SqlProfileProvider类作为配置文件提供的一个例子,除非你已经实施的。

Check out MembershipUser class and ProfileInfo class for more details. You might also wanna check out SqlProfileProvider class as an example of profile provider, unless you already have implemented one.

这篇关于如何从成员资格提供用户/配置文件的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆