Last post Mar 14, 2011 05:42 AM by Dave Sussman
Mar 12, 2011 12:58 PM|GurjitWadhwa|LINK
i've a songs website and users who login can add pointers to these songs in their playlists, when i as an admin delete any song in my website i want it to delete all records from the users playlist as well, so that there are no orphans, here's the code,
this code works fine only for the users who are logged in at that time, for offline users, it don't work, pls help !
MembershipUserCollection Users = Membership.GetAllUsers();
foreach (MembershipUser User in Users)
foreach (CartItem item in Profile.Gaane.Items)
if (item.SongId == Int32.Parse(txtSongID.Text))
Mar 14, 2011 05:42 AM|Dave Sussman|LINK
Profile only works for the currently logged in user. You have to use ProfileBase.Create("username"). Eg:
ProfileBase pb = ProfileBase.Create("username")
object o =pb.GetPropertyValue("PropertyName")
Then cast it to the correct type and use SetPropertyValue to re-store it. Oh, and include the System.Web.Profile namespace.