Jul 5, 2009 at 2:20 AM


Is it possible to have objects (classes) in the profile as with in SQL Provider?

And how can I get the profile of a given user?



Jul 6, 2009 at 5:48 PM

Hi Miguel,

It is possible to have profile items which are object.
Here bellow is a sample of how I use the XmlProviders with custom objects in the profile:

<profile enabled="true" defaultProvider="XmlProfileProvider">
        <add applicationName="MySampleApp" name="XmlProfileProvider" type="Artem.Web.Security.XmlProfileProvider"/>
        <group name="MyContext">
            <add name="Files" type="Artem.Sample.Data.ProfileBag" serializeAs="Binary"/>
            <add name="Templates" type="Artem.Sample.Data.ProfileBag" serializeAs="Binary"/>
        <add name="MyUserSettings" type="Artem.Sample.Data.UserProfile" serializeAs="Binary"/>

As you can see in the example above, I even group some of my profile settings.

If I got your second question right, you know you can get the the current user profile in throught the current HttpContext.
If you don't get the profile as strongly-typed object, you can get the items as following example:

ProfileBag bag = HttpContext.Current.Profile["MyContext.Files"] as ProfileBag;

UserProfile up = HttpContext.Current.Profile["MyUserSettings"] as UserProfile;



Jul 6, 2009 at 9:54 PM

My second question was more "how to get the profile of the user that is not the not that is signed on". Any idea?