Return to Snippet

Revision: 59957
at October 12, 2012 03:14 by box86rowh


Initial Code
protected void lnkLogin_Click(object sender, EventArgs e)
    {
        string AuthType = "DNN";

        DotNetNuke.Security.Membership.UserLoginStatus status = new DotNetNuke.Security.Membership.UserLoginStatus();
        DotNetNuke.Entities.Users.UserInfo userInfo = DotNetNuke.Entities.Users.UserController.ValidateUser(PortalId, txtUser.Text, txtPassword.Text, AuthType, "", PortalSettings.PortalName, DotNetNuke.Services.Authentication.AuthenticationLoginBase.GetIPAddress(), ref status);
        bool success = true;
        switch (status)
        {
            case DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_SUCCESS:
                UserInfo.Membership.Password = txtPassword.Text;
                UserInfo.Username = txtUser.Text;

                DotNetNuke.Entities.Users.UserController.UserLogin(PortalId, UserInfo, PortalSettings.PortalName, DotNetNuke.Services.Authentication.AuthenticationLoginBase.GetIPAddress(), true);
                break;
            case DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_SUPERUSER:
                UserInfo.Membership.Password = txtPassword.Text;
                UserInfo.Username = txtUser.Text;

                DotNetNuke.Entities.Users.UserController.UserLogin(PortalId, UserInfo, PortalSettings.PortalName, DotNetNuke.Services.Authentication.AuthenticationLoginBase.GetIPAddress(), true);
                break;
            default:
                //showerror
                success = false;
                break;
        }
        if (success)
        {
            Response.Redirect(Request.RawUrl);
        }
    }

Initial URL

                                

Initial Description
This is another login method, a little more robust

Initial Title
Other login option for DNN

Initial Tags
login, c#

Initial Language
C#