0

プロファイル フィールドを指定すると、次の方法で各ユーザーに保存します。

Context.Profile.SetPropertyValue("IsSubscribed", isSubscribed.Checked);
Context.Profile.Save();

別のページですべてのユーザーのメールアドレスを取得するにはどうすればよいisSubscribed = trueですか?

4

1 に答える 1

1
        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);
于 2010-10-12T15:25:30.480 に答える