Create users

When creating a user, you must perform the following steps:
  1. Get instances of the user and user profile managers.
    The managers are represented by the UserManager and UserProfileManager classes. For more information about getting their instances, see Managing users.
  2. Create the user.
    To create the user call the CreateUser method of the UserManager class and pass the required arguments. The CreateUser method accepts an output parameter of type System.Web.Security.MembershipCreateStatus, that provides information about the result of the operation. The method returns the instance of the created user. For more information, about the User class, see Users.
  3. Check whether the user has been created successfully.
    If the user has been created successfully, the value of the output parameter must be equal to MembershipCreateStatus.Success.
  4. Create a user profile for the user.
    If the user has been create successful, you create a user profile for him. To do this, call the CreateProfile method of the UserProfileManager class and pass the required parameters. For the type of profile you use SitefinityProfile. For more information, see For developers: User profiles.
  5. Save the changes.
    Finally, you save the changes to both UserManager and UserProfileManager.
Here is a code example:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?

Next article

Query users