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

Forums / Developing with Sitefinity / Getting and updati

Getting and updati

4 posts, 0 answered
  1. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    24 Nov 2010
    Link to this post
    Hi,

    I've developed a module that stores additional profile information on a user. Within my ModuleNewView I create the user, and if the account was successfully created I call base.SaveContent.

    My code looks like:

    System.Web.Security.MembershipCreateStatus _status;
    MembershipUser oUser = Membership.CreateUser(this.oUsername.Text, this.oPassword.Text, this.oLoginEmail.Text, null, null, true, null, out _status);
     
    //check whether the user's account was created
    if (_status == MembershipCreateStatus.Success)
    {
     
        //update the users profile
        ProfileBase userProfile = ProfileBase.Create(oUsername.Text);
        userProfile.SetPropertyValue("FirstName", this.oFirstName.Text);
        userProfile.SetPropertyValue("LastName", this.oLastName.Text);
        userProfile.Save();
     
        //add user to members role
        Roles.AddUserToRole(oUsername.Text, "members");
     
        //send email to user
    }
     
    //Context.Response.Write(_status);
     
    base.SaveContent();

    However, on a seperate user control which is displayed on the public website I need to be able to read this profile information and then update it.

    Are there any code samples of doing this? I cant find any anywhere, Google has even turned against me!

    Thanks
    higgsy
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Nov 2010
    Link to this post
    Hello higgsy,

    Please check this reference - ProfileBase.GetPropertyValue Method

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    24 Nov 2010
    Link to this post
    Hi Ivan,

    Thanks, I'll take a look at that. Whilst I'm on the subject, is it possible to extract the users password? Is it only possible if:

    - I either store passwords in clear text format

    Or

    - I also store question and answer?

    Thanks
    higgsy
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Nov 2010
    Link to this post
    Hello higgsy,

    You can get the passwords only if they are in Clear format. The answer is also  hashed if you do not use "Clear" passwordFormat of the Membership provider.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered