var userService = ApplicationContext.Current.Services.UserService;
var email = "youremailhere";
var date = DateTime.Now;
var userType = new ProvisioningUserType()
{
Alias = "admin",
Name = "Administrators",
CreateDate = date,
};
var user = userService.GetByEmail(email);
userService.SaveUserType(userType);
if (user == null) {
// Create a new user
var newUser = userService.CreateUserWithIdentity(email, email, userType);
newUser.RawPasswordValue = (Membership.Providers["UsersMembershipProvider"] as UsersMembershipProvider).HashPasswordForStorage("password"); ;
// Save the new user
userService.Save(newUser);
}
Create Umbraco User Programatically
Hi All,
We need to create umbraco user programatically through C# (Scheduled task/Window Service) in already existing Umbraco Data Base.
Please help.
Regards
Tarunjit Singh
Hi
This code works for me:
is working on a reply...