Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 5th, 2007, 01:47 PM
Registered User
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Saving personalization properties w/CreateUser

I am following the listing in the Professional Asp.Net 2.0 book (listing 16-8). Basically it shows you how to save the person's first name, last name and age when you are creating a new user. The code will work, however, I think it is saving the profile information for an anonymous user instead of the user I just created. When I look in the users table in the aspnetdb, I get two new users created and the UserId that links to the Profile table is for the anonymous user not my legit user I just created.

I had to add the allowAnonymous in my web.config file to even get the user created:

            <add name="FirstName" allowAnonymous="true" />
            <add name="LastName" allowAnonymous="true" />
            <add name="LastVisited" allowAnonymous="true" />
            <add name="Age" allowAnonymous="true" />
            <add name="Member" allowAnonymous="true" />


Here is my login page:
<%@ Page Language="VB" debug="true"%>

<script runat="server">
    Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, _
       ByVal e As System.EventArgs)

        Profile.FirstName = Firstname.Text
        Profile.LastName = Lastname.Text
        Profile.Age = Age.Text
    End Sub

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Creating Users with Personalization</title>
    <form id="form1" runat="server">
        <asp:CreateUserWizard ID="CreateUserWizard1" Runat="server"  
         BorderWidth="1px" BorderColor="#FFDFAD" BorderStyle="Solid" 
         BackColor="#FFFBD6" Font-Names="Verdana"
         LoginCreatedUser="true" OnCreatedUser="CreateUserWizard1_CreatedUser" ActiveStepIndex="0" >
                <asp:WizardStep ID="WizardStep1" Runat="server" 
                 Title="Additional Information" StepType="Start">
                    <table width="100%"><tr><td>
                    Firstname: </td><td>
                    <asp:TextBox ID="Firstname" Runat="server"></asp:TextBox>
                    Lastname: </td><td>
                    <asp:TextBox ID="Lastname" Runat="server"></asp:TextBox>
                    Age: </td><td>
                    <asp:TextBox ID="Age" Runat="server"></asp:TextBox>
                <asp:CreateUserWizardStep Runat="server">
                        <table border="0" style="font-size: 100%; font-family: Verdana; background-color: #fffbd6">
                                <td align="center" colspan="2" style="font-weight: bold; color: white; background-color: #990000">
                                    Sign Up for
                                    Your New Account</td>
                                <td align="right">
                                    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label></td>
                                    <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                                        ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                <td align="right">
                                    <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label></td>
                                    <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                                        ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                <td align="right">
                                    <asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">Confirm Password:</asp:Label></td>
                                    <asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server" ControlToValidate="ConfirmPassword"
                                        ErrorMessage="Confirm Password is required." ToolTip="Confirm Password is required."
                                <td align="right">
                                    <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label></td>
                                    <asp:TextBox ID="Email" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email"
                                        ErrorMessage="E-mail is required." ToolTip="E-mail is required." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                <td align="right">
                                    <asp:Label ID="QuestionLabel" runat="server" AssociatedControlID="Question">Security Question:</asp:Label></td>
                                    <asp:TextBox ID="Question" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="QuestionRequired" runat="server" ControlToValidate="Question"
                                        ErrorMessage="Security question is required." ToolTip="Security question is required."
                                <td align="right">
                                    <asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="Answer">Security Answer:</asp:Label></td>
                                    <asp:TextBox ID="Answer" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="AnswerRequired" runat="server" ControlToValidate="Answer"
                                        ErrorMessage="Security answer is required." ToolTip="Security answer is required."
                                <td align="center" colspan="2">
                                    <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password"
                                        ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."
                                <td align="center" colspan="2" style="color: red">
                                    <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>
                <asp:CompleteWizardStep Runat="server">
            <StepStyle BorderColor="#FFDFAD" Font-Names="Verdana" 
             BackColor="#FFFBD6" BorderStyle="Solid"
            <TitleTextStyle Font-Bold="True" BackColor="#990000" 

Similar Threads
Thread Thread Starter Forum Replies Last Post
CreateUser Error Gadall ASP.NET 2.0 Professional 1 May 9th, 2007 01:15 AM
Personalization lost after publishing the project ricpue BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 April 30th, 2007 10:15 AM
alternative to multi sessions - personalization? a3321889495 BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 July 27th, 2006 05:12 AM
Page.Unload Personalization Saving wewald BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 3 January 17th, 2006 10:38 AM
Personalization Providers AGS BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 December 3rd, 2005 08:44 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.