Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am Making a Web project and maintaining role management in this application. When I had been created web project then i defined role management in this application. When I creates user using createUser() function data stores in aspnet_Users,aspnet_Membership and other table that one has been created by me (tbl_users) stores all user information including some info of aspnet_Users,aspnet_Membership table. I am able to create data in these tables simultaneously but now i want to update and delete data in these tables simultaneously how can it's possible plz let me know.

Here My code
C#
protected void btn_signup_Click(object sender, EventArgs e)
        {
            try
            {
                // Create new user.
                objuser.email=txt_email.Text;
                objuser.password=txt_password.Text;
                objuser.username = TextBox1.Text;
                if (Membership.RequiresQuestionAndAnswer)
                {
                    MembershipUser newUser = Membership.CreateUser(objuser.email,objuser.password,objuser.username);
                }
                else
                {
                    MembershipUser newUser = Membership.CreateUser(
                     objuser.email,
                     objuser.password,
                     objuser.username);
                    int i = BusinessUser.BusinessRegisterUser(objuser);
                     if (i > 0)
                     {
                         Session["user_authenticate"] = "Verified";
                         Session["user_email"] = objuser.email;
                         Label1.Text = Session["user_email"].ToString();
                         login1.Style.Add("display", "none");
                         logout.Visible = true;
                         Response.Redirect("user_registration.aspx");

                     }
                }
                show_menu();
                //Response.Redirect("login.aspx");
            }
            catch (MembershipCreateUserException ex)
            {
                WarningModal.Show();
               lblWarning.Text = GetErrorMessage(ex.StatusCode);
               pnlIssues.Visible = true;
            }
            catch (HttpException ex)
            {
                WarningModal.Show();
                lblWarning.Text= ex.Message;
            }
        }
        protected void loginUser_Authenticate(object sender, AuthenticateEventArgs e)
        {
            try
            {
                
               if (Membership.ValidateUser(loginUser.UserName, loginUser.Password))
                {
                    Session["user_authenticate"] = "Verified";
                    e.Authenticated = true;
                    Session["user_email"] = loginUser.UserName;
                    objuser.email = Session["user_email"].ToString();
                    Label1.Text = Session["user_email"].ToString();
                    login1.Style.Add("display", "none");
                    logout.Visible = true;
                }
                else
                {
                    e.Authenticated = false;
                }
            }
            catch (Exception ex)
            {
              
            }
        }
Posted
Updated 18-Oct-13 0:50am
v2
Comments
MTProgrammer 28-Oct-13 17:37pm    
SQL Triggers

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900