More in this section

Forums / Developing with Sitefinity / Creating New Users

Creating New Users

4 posts, 0 answered
  1. Daniel
    Daniel avatar
    62 posts
    Registered:
    20 Apr 2009
    16 Jun 2009
    Link to this post
    Hi

    First of all let me apologise if this is a very basic question I am very new to sitefinity!!!

    Basically what I have is a custom user control registers a user with the website.

    This control stores information in a contact table and login details in the telerik_users table.

    The problem is that I cannot log in with the newly registered accounts so I was wondering what the basic create user scenerio is within sitefinity what the password encryption details are as I think that I am not encrypting the password in the same way you guys are!!!

    Hope this makes sense

    Thank you in advance

    Daniel
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    16 Jun 2009
    Link to this post
    Hello Daniel,

    Thank you for contacting the Telerik support.

    In order to create a custom control for registering new users into your web site you will need to utilize the Sitefinity API. Sitefinity uses the membership services included in the .NET Framework to create, modify, and validate user credentials and to manage user settings such as passwords and e-mail addresses.

    Here is an example of what methods to use in order to write a custom control which should register users.
    First you will have to include the following namespaces in your control to use the ASP.NET and Sitefinity membership providers:

    using System.Web.Security; 
    using Telerik.Security; 
    using System.Web.Profile; 


    Then you can use the following to create users profiles, assign them to roles and save their profiles in your web site database:

    // create user using CreateUser method          
    MembershipUser user = Membership.CreateUser("username""password""email@domain.com");        
      
       
    ProfileBase profile = ProfileBase.Create(user.UserName);        
       
    profile.SetPropertyValue("FirstName", user.UserName);       
       
    // assign user to a role      
    Roles.CreateRole(user.UserName);        
       
    Roles.AddUserToRole(user.UserName, user.UserName);      
       
    //save      
    profile.Save();         
     
    For more information you can check:

    Sitefinity Security Overview
    System.Web.Security Namespace
    Telerik.Security.UserManager Class
    UserManager Class members

    Kind Regards,
    Radoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Daniel
    Daniel avatar
    62 posts
    Registered:
    20 Apr 2009
    16 Jun 2009
    Link to this post
    Hi Radoslav

    Thank you very much for the swift detailed reply

    Daniel
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    16 Jun 2009
    Link to this post
    Hello Daniel,

    Let us know if there is anything else that we can do for you.

    Regards,
    Rado
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered