public int createuser()
{
try
{
UserController _UController = new UserController();
UserInfo objUserInfo = new UserInfo();
DotNetNuke.Security.Membership.UserCreateStatus ucs = new DotNetNuke.Security.Membership.UserCreateStatus();
DotNetNuke.Entities.Portals.PortalSettings myPortalSettings = new DotNetNuke.Entities.Portals.PortalSettings();
objUserInfo.FirstName = txtFirstName.Text;
objUserInfo.LastName = txtLastName.Text;
objUserInfo.Username = txtUserName.Text;
objUserInfo.DisplayName = txtFirstName.Text + " " + txtLastName.Text;
objUserInfo.Email = txtEmail.Text;
objUserInfo.PortalID = myPortalSettings.PortalId;
objUserInfo.IsSuperUser = false;
objUserInfo.Membership.CreatedDate = DateTime.Now;
objUserInfo.Membership.Password = this.txtPassword.Text;
objUserInfo.Membership.UpdatePassword = false;
objUserInfo.Roles = new string[] { "Registered Uesrs" };
objUserInfo.Membership.Approved = true;
ucs = DotNetNuke.Entities.Users.UserController.CreateUser(ref objUserInfo);
return objUserInfo.UserID;
}
catch (Exception ex)
{
return 0;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment