AI OnAI Off
if(PersonalizedData.Current!=null)
{
// Print current value
if(PersonalizedData.Current["MyTestKey"]!=null)
Response.Write(PersonalizedData.Current["MyTestKey"]);
// Set new value
PersonalizedData.Current["MyTestKey"] = "MyTestValue";
}
Also see the post in http://www.episerver.com/devforum/ShowTopic.aspx?id=5309 on how to create a plug-in that allows an administrator to change these values for a given user.
if(_userData != null)
{
if (_userData["Personal" + propertyNames[_idx]] != null)
{
_userData["Personal" + propertyNames[_idx]] = propertyValues[_idx];
}
else
{
EPiServer.Core.PropertyString _property = new PropertyString();
_property.Name = "Personal" + propertyNames[_idx];
_property.Value = propertyValues[_idx];
_personalizedProps.Add(_property);
}
}
_user.Save();
if(_userData != null)
_userData.Save();
I can set the std properties in PersonalizedData this way, but new fields are never saved to the DB. Or at least not retrieveable when looping over the GetProperties() collection.
Any trix required?
Thomas