0
  protected void RegistrationMember(object sender, WizardNavigationEventArgs e)
        {
            TextBox txtID = (TextBox)cuwRegistration.FindControl("UserName");
            TextBox txtPass = (TextBox)cuwRegistration.FindControl("Password");
            TextBox txtEmail = (TextBox)cuwRegistration.FindControl("Email");
            TextBox txtQuestion = (TextBox)cuwRegistration.FindControl("Question");
            TextBox txtAnswer = (TextBox)cuwRegistration.FindControl("Answer");

            SqlConnection conRegister = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            SqlCommand cmdRegister;
            conRegister.Open();
            cmdRegister = new SqlCommand("INSERT INTO [Member](UserName, Password, Email, Question, Answer) VALUES (@ID, @Pass, @Email, @Ques, @Ans)", conRegister);
            cmdRegister.Parameters.AddWithValue("@ID", txtID.Text);
            cmdRegister.Parameters.AddWithValue("@Pass", txtPass.Text);
            cmdRegister.Parameters.AddWithValue("@Email", txtEmail.Text);
            cmdRegister.Parameters.AddWithValue("@Ques", txtQuestion.Text);
            cmdRegister.Parameters.AddWithValue("@Ans", txtAnswer.Text);
            cmdRegister.ExecuteNonQuery();
            Roles.AddUserToRole(txtID.Text, "Member");
            conRegister.Close();
        }

Inside my own database database wasn't being insert, but in the ASP.Net Web Admin Tool was inserted and it doesn't no assign to any roles.

1
Contributor
1
Reply
9
Views
4 Years
Discussion Span
Last Post by gahhon
0
    <compilation debug="true" targetFramework="4.0" />
    <authentication mode="Forms" />
    <membership defaultProvider="MyMembershipProvider">
      <providers>
        <add name="MyMembershipProvider" type="System.Web.Security.SqlMembershipProvider" requiresQuestionAndAnswer="false" connectionStringName="connMSJ" />
      </providers>
    </membership>   

Problem Solved by adding these statement into the web.config

This question has already been answered. 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.