Hello,
I am trying to create a custom user registration module for my website... I have working code from DNN5.x ..
but this code does not work in DNN6 ... any advise would be appreciated.
protected void btnRegister_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
bool isValid = true;
UserLoginStatus loginStatus = UserLoginStatus.LOGIN_FAILURE;
if (Page.IsValid)
{
DotNetNuke.Entities.Users.UserInfo oUser = new DotNetNuke.Entities.Users.UserInfo();
string newguing = System.Guid.NewGuid().ToString("N");
oUser.Profile.InitialiseProfile(PortalId);
oUser.PortalID = PortalId;
oUser.Profile.SetProfileProperty("Company", tbCompany.Text);
oUser.Profile.SetProfileProperty("Phone", tbPhone.Text);
oUser.Profile.SetProfileProperty("Address", tbAddress.Text);
oUser.Profile.SetProfileProperty("Name", tbName.Text);
oUser.DisplayName = tbName.Text.Trim();
oUser.IsSuperUser = false;
oUser.Membership.CreatedDate = DateTime.Now;
oUser.Membership.Email = tbEmail.Text;
oUser.Membership.Password = tbPassword.Text;
oUser.Membership.Username = tbEmail.Text.Trim();
oUser.Membership.Approved = true;
UserUserControlBase.UserCreatedEventArgs args = new UserUserControlBase.UserCreatedEventArgs(null);
UserCreateStatus status = UserController.CreateUser(ref oUser);
if (UserCreateStatus.Success == status)
{
args = new UserUserControlBase.UserCreatedEventArgs(oUser);
args.Notify = true;
UserInfo objUser = UserController.ValidateUser(PortalId, oUser.Username, tbPassword.Text, "DNN", "", PortalSettings.PortalName, Dns.GetHostName(), ref loginStatus);
UserAuthenticatedEventArgs eventArgs = new UserAuthenticatedEventArgs(objUser, oUser.Username, loginStatus, "DNN");
eventArgs.Authenticated = false;
eventArgs.Message = String.Empty;
}
args.CreateStatus = status;
UserUserControlBase objUserBase = new UserUserControlBase();
objUserBase.OnUserCreated(args);
objUserBase.OnUserCreateCompleted(args);
}
}
Thanks,