Site registration and keeping the UserId RRS feed

  • Question

  • User1941308304 posted

    I am setting up a site where people register thru the CreateUserWizard, then the create userwizard (which I have added a gender date email and some drop downs to) writes to the database and goes to the next page where they can ad more user information. I have settup an extra database outside of the normal CreateUserWizard database pieces for aspnet. I'm pretty new so would like some guidance since I have only done PHP programming up until now. So I added a User_Account table that grabs all the variables from my e-mails etc, which works fine, but I want to add a UserId which has a relation to the UserId in aspnet_Users(UserId) these UserId's are uniqueindetifiers which I have never dealt with. How can I link these 2 up, so when someone creates the information, the ID writes to the aspnet_Users(UserId) and to the User_Account(UserId) at the same time, just like it writes to the aspnet_Users(UserId) and the aspnet_Membership(UserId) so this information gets shared? Here's the code I'm using to write the rest of my data, which writes fine to the User_Account but it's just there and not associated with the actual User. I want to be able to use this information later on, but also keep everything very secure. I need it this way, so when the user goes to the next page, it will have another CreateUserWizard with a few steps that also grab the UserId then put that information in another table while using relationships again. Would I use sessions on the next CreateUserID then on the Create_Account.aspx page after they get thru this original form piece? But they are logged in thru the userwizard and the asp account manager pieces, I just don't understand how it sees they are logged in and out I guess, sessions I know how to set and clear easily in PHP but I want to go more securely then sessions I guess.

    protected void RegisterUser_NextButtonClick(object sender, WizardNavigationEventArgs e)
                     DropDownList year = (DropDownList)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("DropDownListYearList");
                     DropDownList month = (DropDownList)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("DropDownListMonthList");
                     DropDownList day = (DropDownList)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("DropDownListDayList");
                     DropDownList Gender = (DropDownList)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("DropDownListGenderList");
                     string yearnew = year.SelectedValue;
                     string monthnew = month.SelectedValue;
                     string daynew = day.SelectedValue;
                     DateTime date = (DateTime)string.Format(monthnew + "/" + daynew + "/" + yearnew); 
                     TextBox zipcodetb = (TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("ZipCode");
                     TextBox emailtb = (TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("Email");
                      SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["myconnection"].ConnectionString);
                      string sql = "INSERT INTO User_Values( DateofBirth, ZipCode, Email, Gender) VALUES( @birthdate, @zipcode, @email, @gender)";
                       SqlCommand cmd = new SqlCommand(sql, connection);
                       cmd.Parameters.AddWithValue("@gender", Gender.SelectedValue);
                       cmd.Parameters.AddWithValue("@birthdate", date);
                       cmd.Parameters.AddWithValue("@zipcode", zipcodetb.Text);
                       cmd.Parameters.AddWithValue("@email", emailtb.Text);
    Friday, November 11, 2011 6:00 PM


  • User-578657687 posted


    , I just don't understand how it sees they are logged in and out I guess, sessions I know how to set and clear easily in PHP but I want to go more securely then sessions I guess.

    For ASP.NET Session please check this reference:


    You can retrieve the UserID when creating a User, I am sure your User_Account table have a filed named "UserID", so you can add a new record to the User_Account table based on the UserID and additional inforamtion.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 14, 2011 4:53 AM