如何从会员制供应商那里获得用户/档案的列表?

 2023-02-16    305  

问题描述

我正在利用这个会员提供者.我陷入了获取用户列表+配置文件(名字,姓氏,标题等)

我知道有成员身份的方法.GetAllUsers(),但我不知道如何将其与我存储在个人资料提供程序中的名字,我存储的姓氏.

如何从会员制供应商那里获得用户/档案的列表?

感谢

推荐答案

emperenthip.getAllusers()返回emperenceUserCollection,您可以用于访问单个隶属度数.示例:

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

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

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

但是,默认情况下,除非您在个人资料提供程序中手动指定它们,否则没有第一个名称和LastName属性.

签出 empersialuser类和 profileinfo class 有关更多详细信息.您也可能想查看 sqlprofileprovider类个人资料提供商的示例,除非您已经实现了一个.

其他推荐答案

首先创建用户时,使用相同的用户名创建配置文件:

// Create an empty Profile for the new User
ProfileCommon p = (ProfileCommon) ProfileCommon.Create("username", true);

然后下次检索它..

// Retrieve a particular profile
ProfileCommon userProfile = Profile.GetProfile("username");

谢谢.

以上所述是小编给大家介绍的如何从会员制供应商那里获得用户/档案的列表?,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!

原文链接:https://77isp.com/post/33857.html

=========================================

https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。