プロファイル フィールドを指定すると、次の方法で各ユーザーに保存します。
Context.Profile.SetPropertyValue("IsSubscribed", isSubscribed.Checked);
Context.Profile.Save();
別のページですべてのユーザーのメールアドレスを取得するにはどうすればよいisSubscribed = true
ですか?
プロファイル フィールドを指定すると、次の方法で各ユーザーに保存します。
Context.Profile.SetPropertyValue("IsSubscribed", isSubscribed.Checked);
Context.Profile.Save();
別のページですべてのユーザーのメールアドレスを取得するにはどうすればよいisSubscribed = true
ですか?
List<String> subscribedEmails = new List<String>();
ProfileInfoCollection profiles = ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All);
foreach (ProfileInfo profileInfo in profiles)
{
ProfileBase profile = ProfileBase.Create(profileInfo.UserName);
if ((bool)profile.GetPropertyValue("IsSubscribed"))
{
subscribedEmails.Add((string)profile.GetPropertyValue("Email"));
}
}
編集:メンバーシップシステムからユーザーのメールアドレスを取得するには、次を使用します。
subscribedEmails.Add(Membership.GetUser(profileInfo.UserName).Email);