newbie: Problem with CreateUserWizard

Discussion in 'ASP .Net' started by Jeff, Feb 8, 2007.

  1. Jeff

    Jeff Guest

    Hey

    Below is the source code of the CreateUserWizard placed on one my web pages
    (asp.net 2.0).

    The problem is that the AssignUserToRole method isn't triggered when
    clicking on the finish button (that Images/Go.gif image).

    So I'm wondering what I'm doing wrong here

    ******************* markup ********************
    <asp:CreateUserWizard FinishDestinationPageUrl="~/Default.aspx"
    ID="CreateUserWizard1"
    Width="300px" runat="server"
    LoginCreatedUser="false"
    CreateUserButtonType="Image"
    CreateUserButtonImageUrl="Images/Go.gif"
    OnFinishButtonClick="AssignUserToRole">

    <WizardSteps>
    <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
    <ContentTemplate>
    <label for="Username">User name:</label>
    <asp:TextBox id="Username" runat="server" />

    <label for="Password">Password:</label>
    <asp:TextBox id="Password" runat="server"
    TextMode="Password" />

    <label for="ConfirmPassword">Confirm
    Password:</label>
    <asp:TextBox id="ConfirmPassword" runat="server"
    TextMode="Password" />

    <label for="Email">Email</label>
    <asp:TextBox id="Email" runat="server" />

    <label for="Question">Security question:</label>
    <asp:TextBox id="Question" runat="server" />

    <label for="Answer">Security answer:</label>
    <asp:TextBox id="Answer" runat="server" />


    </ContentTemplate>
    </asp:CreateUserWizardStep>

    <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
    <ContentTemplate>rrrr</ContentTemplate>
    </asp:CompleteWizardStep>
    </WizardSteps>
    </asp:CreateUserWizard>

    ***************** AssignUserToRole code **********************
    protected void AssignUserToRole(object sender, EventArgs e)
    {
    MembershipUser user = Membership.GetUser();
    user.IsApproved = false;
    MailMessage mail = new MailMessage("", user.Email,
    "Thank you", "Hello World");
    SmtpClient smtpClient = new SmtpClient();
    smtpClient.Send(mail);
    mail.Dispose();
    }

    Any suggestions?
     
    Jeff, Feb 8, 2007
    #1
    1. Advertising

  2. Jeff

    Jeff Guest

    CASE SOLVED

    I put the functionality into the CreatedUser event

    Jeff


    "Jeff" <> wrote in message
    news:...
    > Hey
    >
    > Below is the source code of the CreateUserWizard placed on one my web
    > pages (asp.net 2.0).
    >
    > The problem is that the AssignUserToRole method isn't triggered when
    > clicking on the finish button (that Images/Go.gif image).
    >
    > So I'm wondering what I'm doing wrong here
    >
    > ******************* markup ********************
    > <asp:CreateUserWizard FinishDestinationPageUrl="~/Default.aspx"
    > ID="CreateUserWizard1"
    > Width="300px" runat="server"
    > LoginCreatedUser="false"
    > CreateUserButtonType="Image"
    > CreateUserButtonImageUrl="Images/Go.gif"
    > OnFinishButtonClick="AssignUserToRole">
    >
    > <WizardSteps>
    > <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
    > <ContentTemplate>
    > <label for="Username">User name:</label>
    > <asp:TextBox id="Username" runat="server" />
    >
    > <label for="Password">Password:</label>
    > <asp:TextBox id="Password" runat="server"
    > TextMode="Password" />
    >
    > <label for="ConfirmPassword">Confirm
    > Password:</label>
    > <asp:TextBox id="ConfirmPassword"
    > runat="server" TextMode="Password" />
    >
    > <label for="Email">Email</label>
    > <asp:TextBox id="Email" runat="server" />
    >
    > <label for="Question">Security
    > question:</label>
    > <asp:TextBox id="Question" runat="server" />
    >
    > <label for="Answer">Security answer:</label>
    > <asp:TextBox id="Answer" runat="server" />
    >
    >
    > </ContentTemplate>
    > </asp:CreateUserWizardStep>
    >
    > <asp:CompleteWizardStep ID="CompleteWizardStep1"
    > runat="server">
    > <ContentTemplate>rrrr</ContentTemplate>
    > </asp:CompleteWizardStep>
    > </WizardSteps>
    > </asp:CreateUserWizard>
    >
    > ***************** AssignUserToRole code **********************
    > protected void AssignUserToRole(object sender, EventArgs e)
    > {
    > MembershipUser user = Membership.GetUser();
    > user.IsApproved = false;
    > MailMessage mail = new MailMessage("", user.Email,
    > "Thank you", "Hello World");
    > SmtpClient smtpClient = new SmtpClient();
    > smtpClient.Send(mail);
    > mail.Dispose();
    > }
    >
    > Any suggestions?
    >
    >
     
    Jeff, Feb 8, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lloyd Dupont

    [newbie & 2.0] ASP:CreateUserWizard

    Lloyd Dupont, Nov 8, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    428
    Lloyd Dupont
    Nov 8, 2004
  2. =?Utf-8?B?R3V5?=

    CreateUserWizard problem, what goes wrong?

    =?Utf-8?B?R3V5?=, Mar 8, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    405
    =?Utf-8?B?R3V5?=
    Mar 8, 2006
  3. =?Utf-8?B?R3V5?=

    Problem with CreateUserWizard

    =?Utf-8?B?R3V5?=, Mar 9, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,077
    =?Utf-8?B?R3V5?=
    Mar 9, 2006
  4. Bob
    Replies:
    0
    Views:
    1,318
  5. Mich
    Replies:
    0
    Views:
    611
Loading...

Share This Page