+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Get customer property value from current user profile

Get customer property value from current user profile

2 posts, 0 answered
  1. Jason Green
    Jason Green avatar
    53 posts
    Registered:
    18 Sep 2009
    30 Mar 2011
    Link to this post
    I added a custom property to my user setup.  So as customers are added to the administration > users section of the screen we can get some added details.  Now in a custom user control I want to get the value of that custom property from the current users.

    I can't seem to find any documentation on doing this.  I see some posts getting all users for a role the cycling through with a funky LINQ statement to pull the property value, but there has to be a simple way to do this.

    1)  how do I get to the current user 

    2)  how to I get to that users profile to pull out the custom property


    Is this close?
    myvalue = Profile.GetProfile(UserManager.GetCurrentUserName).GetPropertyValue("CustomPropertyName");
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    04 Apr 2011
    Link to this post
    Hello Jason,


    1. You can use UserManager.GetCurrentUser()

    2. We use the ASP.NET Profile provider, so you can use the methods that ASP.NET ProfileBase expose.

    http://msdn.microsoft.com/en-us/library/ms151823%28v=VS.80%29.aspx 

    Best wishes,
    Ivan Dimitrov
    the Telerik team

2 posts, 0 answered