0

I want to create user dynamically. I used

Membership.CreateUser(smemno.Text.ToString(), spwd.Text.ToString(),semail.Text.ToString(),ssecquestion.SelectedItem.Text.ToString(),sans.Text.ToString(),true);

but error occur : "No overload for method 'CreateUser' takes '6' arguments"

Should I create new method named CreateUser(), if "yes" then what is code for that and what it return...
please help me.

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by jomgrg
0

You are missing **MemberShipCreateStatus** argument.

System.Web.Security.MembershipCreateStatus mcs;
System.Web.Security.Membership.CreateUser("username", "password", "username@email.com", "passwordQuestion", "passwordAnswer", true, out mcs);

        switch (mcs)
        {
            case System.Web.Security.MembershipCreateStatus.Success:
                break;
            case System.Web.Security.MembershipCreateStatus.DuplicateEmail:
                break;
            case System.Web.Security.MembershipCreateStatus.DuplicateUserName:
                break;
        }
0

hope helps u

private string GetErrorMessage(MembershipCreateStatus status)
        {
            switch (status)
            {
                case MembershipCreateStatus.DuplicateEmail:
                    return "right Message";
                case MembershipCreateStatus.DuplicateUserName:
                    return "right Message";
                case MembershipCreateStatus.InvalidAnswer:
                    return "right Message";
                case MembershipCreateStatus.InvalidEmail:
                    return "right Message";
                case MembershipCreateStatus.InvalidPassword:
                    return "right Message";
                case MembershipCreateStatus.InvalidQuestion:
                    return "right Message";
                case MembershipCreateStatus.ProviderError:
                    return "right Message";
                case MembershipCreateStatus.UserRejected:
                    return "right Message";
                default:
                    return "";
            }
        }

MembershipCreateStatus st;
MembershipUser NewUser = Membership.CreateUser(txtUserName.Text, txtPassword.Text, txtEmail.Text, txtSecurityQuestion.Text, txtsecurityAnswer.Text, false, out st);
                        if (NewUser == null)
                        {
                            lblError.Visible = true;
                            lblError.Text = GetErrorMessage(st);
                            return;
                        }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.