I am looking for a way to create my own user registration page in DotNetNuke. I do not want to replace the default one, I just want to put dnn registration in a moduule I am building. Any insight on how to go about this would be great, I would like to use the current membership provider included with DotNetNuke.
+1
A:
Everything you need to know is here, hope this helps someone else:
http://www.engagesoftware.com/Blog/EntryId/75/Membership-Provider-Video-Part-I.aspx
OK I want to share my code with everyone as this was a pain to figure out, but this will give an idea of what to do:
using DotNetNuke;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Users;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Security.Membership;
namespace DotNetNuke.Modules.Promotions
{
/// -----------------------------------------------------------------------------
/// <summary>
/// The ViewPromotions class displays the content
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// </history>
/// -----------------------------------------------------------------------------
partial class View : PortalModuleBase, IActionable
{
public void btnRegister_Click(object sender, EventArgs e)
{
try
{
UserCreateStatus userstatus = UserCreateStatus.AddUser;
UserInfo NewUser = new UserInfo();
NewUser.FirstName = txtFirstname.Text;
NewUser.LastName = txtLastName.Text;
NewUser.Username = txtUserName.Text;
NewUser.DisplayName = txtUserName.Text;
NewUser.Profile.City = txtCity.Text;
NewUser.Profile.Country = "United States";
NewUser.Email = txtEmail.Text;
NewUser.Username = txtUserName.Text;
NewUser.Membership.Password = txtPassword.Text;
if (PortalSettings.UserRegistration != Convert.ToInt32(DotNetNuke.Common.Globals.PortalRegistrationType.PublicRegistration))
{
NewUser.Membership.Approved = true;
}
{
NewUser.Membership.Approved = false;
}
UserCreateStatus userstatsus = UserController.CreateUser(ref NewUser);
}
catch (Exception ex)
{
Console.Write(ex);
}
}
James Campbell
2010-02-12 16:14:15
your link says "You Do Not Have Permission To View The Requested File"
controlfreak123
2010-02-12 16:15:48
sorry, all fixed now.
James Campbell
2010-02-12 16:26:46
It may not be the Exact answer, but, it tells me where I need to be and gave me a good overview of the provider. What I will use, is use the dnn membership provider and create my own page referencing that. This way, I can cutomize registration anywhere, and i do not have to rewrite the provider.
James Campbell
2010-02-12 16:40:27
I have updated with code to create user registration
James Campbell
2010-02-15 15:17:47