To store settings for the current user, use the built-in Profile support in ASP.NET.
EPiServer is using this for its own need to store information on a per user basis. (The built-in values EPiServer needs are accessible through the class EPiServerProfile that is a subclass of the ASP.NET class ProfileBase).
You can get access to the current users EPiServer’s Profile instance accessing the static property Current on the EPiServerProfile class. There is also a default indexer property inherited from ASP.NET’s ProfileBase class that you can use for you own values.
EPiServer.Personalization.EPiServerProfile.Current["MySetting"] = "Test123";
For performance reasons use only string, int, DateTime and avoid objects that must be serialized. There is also support for handling anonymous users (not logged in) if needed.
Read more: http://msdn2.microsoft.com/en-us/library/at64shx3.aspx
Update: Read more about changes to Profile information in SP1 for EPiServer CMS 5 R1.
Tags: ASP.NET, EPiServer, EPiServerProfile
-
Nice short blogpost, found it when searching Google for ProfileBase and EPiServer. Faster than looking in the SDK
Back to migrating the site from 4.62 to CMS 5…
-
Hi Fredrik,
I have a module wherein I have to get a particular Users Profile and Update some of his Profile settings.So Initially to get the users Profile I use
EPiServerProfile.Get method ,but the problem that I am facing is that even after saving the details ,next Time I m not getting the Users details instead the PropertyValue gives a null reference even though in the profile data it is displaying the value.Can u please help me out in this?
I m totally stuck with this unusual behaviour.Thanks in advance.
Regards,
S.K. SreeRaghavendra

![Fredrik Haglund [Photo by: Kristina Sahlén]](http://blog.fredrikhaglund.se/wp-content/uploads/2010/03/fredrik200.jpg)

2 comments
Comments feed for this article
Trackback link: http://blog.fredrikhaglund.se/blog/2007/11/28/profile-data-in-episerver/trackback/