MigrateAnonymous event handler automatically copies the values of all anonymous Profile properties to the user's current authenticated profile.
File: Global.asax
<%@ Application Language="C#" %>
<script runat="server">
public void Profile_OnMigrateAnonymous(object sender, ProfileMigrateEventArgs args)
{
ProfileCommon anonProfile = Profile.GetProfile(args.AnonymousID);
foreach (SettingsProperty prop in ProfileBase.Properties)
Profile[prop.Name] = anonProfile[prop.Name];
ProfileManager.DeleteProfile(args.AnonymousID);
AnonymousIdentificationModule.ClearAnonymousIdentifier();
}
</script>
|