Migrating Anonymous User Settings
// Carry over profile property values from an anonymous to an authenticated state
void Profile_MigrateAnonymous(Object sender, ProfileMigrateEventArgs e) {
ProfileCommon anonProfile = Profile.GetProfile(e.AnonymousID);
// Merge anonymous shopping cart items to the authenticated shopping cart items
foreach (CartItemInfo cartItem in anonProfile.ShoppingCart.CartItems)
Profile.ShoppingCart.Add(cartItem);
// Merge anonymous wishlist items to the authenticated wishlist items
foreach (CartItemInfo cartItem in anonProfile.WishList.CartItems)
Profile.WishList.Add(cartItem);
// Clean up anonymous profile
ProfileManager.DeleteProfile(e.AnonymousID);
AnonymousIdentificationModule.ClearAnonymousIdentifier();
// Save profile
Profile.Save();
}
void Profile_MigrateAnonymous(Object sender, ProfileMigrateEventArgs e) {
ProfileCommon anonProfile = Profile.GetProfile(e.AnonymousID);
// Merge anonymous shopping cart items to the authenticated shopping cart items
foreach (CartItemInfo cartItem in anonProfile.ShoppingCart.CartItems)
Profile.ShoppingCart.Add(cartItem);
// Merge anonymous wishlist items to the authenticated wishlist items
foreach (CartItemInfo cartItem in anonProfile.WishList.CartItems)
Profile.WishList.Add(cartItem);
// Clean up anonymous profile
ProfileManager.DeleteProfile(e.AnonymousID);
AnonymousIdentificationModule.ClearAnonymousIdentifier();
// Save profile
Profile.Save();
}