Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

need to create a two page profile web site.

I have to build a two page registration with the asp.net built in registration.

 If you goto the site omegalove.com and click on registration then u can see that I have only one page.

How can I build the second.
I will be using the ProfileCommon pc = Profile.GetProfile(user.UserName);

protected void imgRegister_Click(object sender, System.EventArgs e)

            char Gender = ' ';
            //Gender = rdoFemale.Checked ? 'F' : ' ';
            //Gender = (rdoMale.Checked && Gender == ' ') ? 'M' : Gender;

            string number_server_side = (string)Session[ADSSAntiBot.SESSION_CAPTCHA];
            if (number_server_side == TextBox_number.Text)
                Label_valid.Visible = true;
                Label_invalid.Visible = true;


                MembershipUser user = Membership.CreateUser(txtUserName.Text, txtPassword.Text, txtEmail.Text);

                //ProfileCommon pc = Profile.GetProfile(user.UserName);
                //pc.Email = txtEmail.Text;
                //pc.FullName = txtFullName.Text;
                //pc.DOB = Datepicker.Selected_Date;
                //pc.Gender = Gender.ToString();

                //pc.City = ddlCity.SelectedValue;
                //pc.Region = ddlRegion.SelectedValue;
                //pc.Country = ddlCountryRegister.SelectedValue;

                //lblMessage.Text = "User created successfully!";

                //// Generate Confirmation GUID
                //string sConfirmationGUID = System.Guid.NewGuid().ToString("N");
                //string sUserIP = Request.UserHostAddress;
                //string sSessionID = this.Session.SessionID;

                for (int i = 0; i < Session.Count; i++)
                    Response.Write("<p>" + Session.Keys.ToString() + " - " + Session.ToString() + "</p>");


            catch (Exception ex)
                lblMessage.Text = ex.Message;



  • 11
  • 10
1 Solution
Hello, can you elaborate on what you are trying to achieve?  because adding another page is just rightclicking on your project and selecting add new item -> aspx page.   I'm not sure what you want to achieve.
mathieu_cuprykAuthor Commented:
then i must create another page and how do I store the variables.
if this is the first page register_Click
                ProfileCommon pc = Profile.GetProfile(user.UserName);
                pc.Email = txtEmail.Text;
                pc.FullName = txtFullName.Text;
                pc.DOB = Datepicker.Selected_Date;
                pc.Gender = Gender.ToString();

                pc.City = ddlCity.SelectedValue;
                pc.Region = ddlRegion.SelectedValue;
                pc.Country = ddlCountryRegister.SelectedValue;

should i have a redirect or use server.transfer and for the next page
I will have to use update.
you need not to worry about how they are stored in database,
because asp.net handles that for you.
What you only should care about is that what informatino you
want to store for each user.
For example, I want to store Name and Age of each user in
the profile table, hence I will declare two properties
in the profile tag in my web.config file like this:

    <profile >
        <add name="Name" allowAnonymous="true" />
        <add name="Age" allowAnonymous="true" type="System.Int16"/>

That's how you tell asp.net that you will be storing these two properties and
that asp.net must handle how it is stored in database.

To access them use code something like this:

   nameTextBox.Text = Profile.Name;
   ageTextBox.Text = Profile.Age.ToString();

And you can update the profile properties as you have already written code for it.
No need to worry about the internal structure of how they are stored in the database.
Hope it helped!

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

mathieu_cuprykAuthor Commented:
this I know but if it is two pages how should I do this?
if you goto omegalove.com registration page. you will see one
page. I will need to make it two.
Note I am not using <asp:CreateUserWizard runat="server" ID="CreateUserWizard1" AutoGeneratePassword="False"
      ContinueDestinationPageUrl="~/Default.aspx" FinishDestinationPageUrl="~/Default.aspx" OnFinishButtonClick="CreateUserWizard1_FinishButtonClick" OnCreatedUser="CreateUserWizard1_CreatedUser">

mathieu_cuprykAuthor Commented:
I am using the personalization profile. I have a two page registration and I am not sure how I should deal with this,

Options: Server.Transfer


                   Panel driven


Which way would u go about this?



protected void btnRegisterPage1_Click(object sender, EventArgs e)
          MembershipUser user=  Membership.CreateUser(UserId, UserId, txtEmail.Text);
                //don't really need next line, just habit...
                FormsAuthentication.Authenticate(UserId, UserId);
                WebProfile Profile = new WebProfile();
                Profile.FirstName = this.txtFirstName.Text;
                Profile.LastName = this.txtLastName.Text;
                Profile.Newsletter = this.chkNewsLetter.Checked;
                Profile.Email = this.txtEmail.Text;

                GenericIdentity userIdentity = new GenericIdentity(UserId);
                GenericPrincipal userPrincipal =
                  new GenericPrincipal(userIdentity, new string[ { "User" });
                Context.User = userPrincipal;

                if (!Roles.IsUserInRole(User.Identity.Name, "User"))
                    PAB.Web.Providers.SimpleSqlRoleProvider prov = new SimpleSqlRoleProvider();
                    NameValueCollection config = new NameValueCollection();
                    config["connectionStringName"] = "LiveId";
                    System.Configuration.ConnectionStringSettings ConnectionStringSettings =
                    prov.AddUsersToRoles(new string[ {User.Identity.Name}, new string[ {"User"});


Hi, your problem will be solved using Cross-Page Posting.

Your Scenario/ Problem:
You are creating a multi-page (aspx pages) form that collects different information on each page.


You can configure a button on say page1.aspx to post to page2.aspx and you will be able to
access page1.aspx controls using special properties in page2 as it is, no need to use
Session variables!


The Page class exposes a property named PreviousPage. If the source page and target page are in
 the same ASP.NET application, the PreviousPage property in the target page contains a reference
to the source page

To Enable Crosspage postback from page1.aspx to page2.aspx,
you introduce a button in page1.aspx which posts to page2.aspx like this

<asp:Button runat="server" ID="_button"
                PostBackUrl="~/Page2.aspx" Text=" = " />

The following code example shows how you can get the value of the TextBox1 control on the source page.

if (Page.PreviousPage != null)
    TextBox SourceTextBox =
    if (SourceTextBox != null)
        Label1.Text = SourceTextBox.Text; //Now this label1 is on your current page i.e. (page2.aspx)

Hopefully you got the idea of what should be done.

Now further down, you may be thinking what if I want to access data of both page1.aspx -> page2.aspx
in page3.aspx , now there's no previouspage of previouspage or something like that but
you can do it easily.

For example If i'm collection data 'a' and 'b' in page1.aspx and 'c' and 'd' in page2.aspx now i want
a,b,c,d all of them in page 3, then on page2.aspx using previouspage I'll be storing a,b in a textbox/hidden
field and then in page3.aspx i'll get 'c', 'd' and 'a,b'  as three values from page2.aspx as part of work
i did in page2.  

So in this way I can continue propagating my values to number of pages. This is a solution where you are not
using session variables, else you can do it by session variables or less secure query strings also but

In case you are not sure about the logic yet, need something to refer to, here's a very good tutorial regarding the topic I discussed in greater depth.


Read it for a better understanding but you can very well start off with what I wrote.

I guess this will solve your problem.

mathieu_cuprykAuthor Commented:
U see I can use the userid in the second page.

However, how can I use
ProfileCommon pc = Profile.GetProfile(user.UserName); this concept
if someone leaves the page.
I guess you should avoid using 'Membership.Createuser'... till you reach your last registration page be it page2 or page 3...

Till that you should use variables/hidden fields etc.. to store values and pass on using crosspage postback or session etc.... Then on last page create the user and profile with all the information at your disposal.
 Its generally not good to create something on page1 and keep updating that stuff for rest of the registration forms , when you split the whole registration process over multiple pages.

mathieu_cuprykAuthor Commented:
is there an example of a site that does this?
For the code (not the one i mentioned), if you just want to update a profile from a page,
go thru this link:

there under the sub btnUpdatePreferences_Click, the user is updating current user's profile

Here's link for all profile information (with SourceCode) that you'll need

It contains information regarding:

Anonymous Profiles
Anonymous Profiles
Migrating Anonymous Profiles to Authenticated Profiles
Defining Profile Properties with a Custom Base Class
Defining Profile Properties with a Custom Base Class
Deleting a Profile
mathieu_cuprykAuthor Commented:
for the update, they are using a redirect? I don't see cross-page posting.
I already mentioned I'm posting code for profile updating not mine, coz its not available directly (i.e updating profiles via cross page postback etc..). I suggested you a solution.
I'm not sure if there is a ready made solution available online that you can use.
mathieu_cuprykAuthor Commented:
Yes it is a very good control, but It is against your Design Decision of having seperate registrtion forms and code.
Basically it will reside on the same page, i.e. if you place multiview control on page1.aspx,  your registration will be completed on page1.aspx itself, no second page.

Multiview can display at a time one of its views, so then you have to change your design such that you store your controls of page1 in first view, page2 in second view etc...  

Now on the next button/register button of first view, you just change multiview's active view and move to second view (on the same page tho)  

If its ok with you, ya can go ahead with it.
mathieu_cuprykAuthor Commented:
this is true! So Cross paging is used in 3.5?
No its an old concept, u can use it in .net 2.0 framework too5
mathieu_cuprykAuthor Commented:
what is there in 3.5?
There is nothing new in 3.5 framework that can help you with this. I wonder why you want to use 3.5! This is an old concept will work in newer frameworks also.
mathieu_cuprykAuthor Commented:
which concept will not work in newer frameworks.
I said it will work in newer frameworks also.
mathieu_cuprykAuthor Commented:
tech if you join

What do you think of the setup.

When registering?

when u enter the first page information.

automatically it would be like doing a pc.Save
with membership profile
the second and third ,,, pages.
do they use something like an update.Save

Cross paging is not used in this case?
it would appear that they are passing an id?
storing it in a cookie or session.
what do u think?

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 11
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now