Page 1 of 1

User Profile Question

Posted: Tue Apr 01, 2008 4:31 pm
by keats76
I'm fiddling with the User.Profile because I think it would work well to store custom profile data for the users. For example, let's say your implementation requires that you store the customer's age ... I'd like to create a helper class to allow the application to add an age property to the User.Profile for use in the registration (and or profile display) screens (as well as data mining).

That leads to my question:

When is the User.Profile object instantiated? Or is it currently in use?

When I try to play with the Personalization.Profile.SetPropertyValues method on the User.Profile object I receive a null pointer exception. It looks like the Profile object is not initialized, and there is no setter for the Profile (just a getter) so I can't instantiate one myself.

Any thoughts?

Thanks,
Mike

Re: User Profile Question

Posted: Tue Apr 01, 2008 6:06 pm
by Logan Rhodehamel
It's not used. I think it might even be disabled in our default web.config.

There is a custom field collection for user that you could use. Try User.Settings.SetValueByKey and User.Settings.GetValueByKey. The only restriction is you cannot have multiple fields with the same key.

Re: User Profile Question

Posted: Wed Apr 02, 2008 7:29 am
by keats76
That did the trick. Thanks!

Mike