Best way to Migrate Anonymous Profile

狂风中的少年 提交于 2019-11-30 19:14:12

This is the way to go. But I would suggest a generalization. Instead of hardcoding each property you could loop through the ProfileBase.Properties collection. Something along these lines:

var anonymousProfile = Profile.GetProfile(args.AnonymousID);
foreach(var property in anonymousProfile.PropertyValues)
{
    Profile.SetPropertyValue(property.Name, property.PropertyValue);
}

Since property groups are represented as part of the property names (e.g. "Settings.Theme" represents the Theme property within the Settings group) the above code should also work with property groups.

Did I understand your question correctly?

Migrating Profile Properties During Log On

http://msdn.microsoft.com/en-us/library/taab950e.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!