ASP.NET Membership Issues With Registration

我怕爱的太早我们不能终老 提交于 2019-12-02 09:08:36

Have you checked to see this is not a problem with password complexity? I know I have had issues with this in the past...

You redirect the page before you are able to see the output if the status is not equal to success.

Btw. it might be better to inherit the sqlmembership provider and extend it with your own extra db inserts, at least if you are not inserting extra data. Or are you asking more than the default stuff on the first creation of the account?

Try it like this code and see what the value of the enum is in the lblMessage

protected void btnRegister_Click(object sender, EventArgs e) {

      if (!ValidatePage()) return;

        FormsAuthentication.SignOut();
            MembershipCreateStatus status;
            Data.User user = UserManager.CreateUser(txtEmail.Text.Trim(), txtPassword.Text.Trim(), out status);
            switch (status) { 
        case MembershipCreateStatus.Success:
                            UserManager.Save(user);
            Response.Redirect("~/login.aspx");
                            break;
                    default:
                            lblMessage.Text = status.ToString();
                            break;
            }       

    }

grrgr, stupid markup thing

Hope this helps.

My first guess is that ValidatePage() return false.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!