如何在 DotNetNuke 4.9.2 中创建用户注册页面

发布于 2024-08-21 23:16:08 字数 122 浏览 4 评论 0原文

我正在寻找一种在 DotNetNuke 中创建自己的用户注册页面的方法。我不想替换默认的,我只想将 dnn 注册放入我正在构建的模块中。任何有关如何解决此问题的见解都很棒,我想使用 DotNetNuke 中包含的当前会员提供程序。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

羁客 2024-08-28 23:16:09

您需要了解的所有内容都在这里,希望这对其他人有帮助:

http://www.engagesoftware.com/Blog/EntryId/75/Membership-Provider-Video-Part-I.aspx

好的,我想与大家分享我的代码,因为这很痛苦弄清楚,但这将给出要做什么的想法:

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);
            }
        }

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);
            }
        }
多彩岁月 2024-08-28 23:16:09

您缺少 NewUser.PortalId
可以将其设置为 NewUser.PortalId = PortalId;

Your missing the NewUser.PortalId.
This can be set to NewUser.PortalId = PortalId;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文