Partager via


CreateUserWizard Web Server Control Declarative Syntax 

Provides a user interface for creating new Web site user accounts.

<asp:CreateUserWizard
    AccessKey="string"
    ActiveStepIndex="integer"
    Answer="string"
    AnswerLabelText="string"
    AnswerRequiredErrorMessage="string"
    AutoGeneratePassword="True|False"
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
               Inset|Outset"
    BorderWidth="size"
    CancelButtonImageUrl="uri"
    CancelButtonText="string"
    CancelButtonType="Button|Image|Link"
    CancelDestinationPageUrl="uri"
    CellPadding="integer"
    CellSpacing="integer"
    CompleteSuccessText="string"
    ConfirmPasswordCompareErrorMessage="string"
    ConfirmPasswordLabelText="string"
    ConfirmPasswordRequiredErrorMessage="string"
    ContinueButtonImageUrl="uri"
    ContinueButtonText="string"
    ContinueButtonType="Button|Image|Link"
    ContinueDestinationPageUrl="uri"
    CreateUserButtonImageUrl="uri"
    CreateUserButtonText="string"
    CreateUserButtonType="Button|Image|Link"
    CssClass="string"
    DisableCreatedUser="True|False"
    DisplayCancelButton="True|False"
    DisplaySideBar="True|False"
    DuplicateEmailErrorMessage="string"
    DuplicateUserNameErrorMessage="string"
    EditProfileIconUrl="uri"
    EditProfileText="string"
    EditProfileUrl="uri"
    Email="string"
    EmailLabelText="string"
    EmailRegularExpression="string"
    EmailRegularExpressionErrorMessage="string"
    EmailRequiredErrorMessage="string"
    Enabled="True|False"
    EnableTheming="True|False"
    EnableViewState="True|False"
    FinishCompleteButtonImageUrl="uri"
    FinishCompleteButtonText="string"
    FinishCompleteButtonType="Button|Image|Link"
    FinishDestinationPageUrl="uri"
    FinishPreviousButtonImageUrl="uri"
    FinishPreviousButtonText="string"
    FinishPreviousButtonType="Button|Image|Link"
    Font-Bold="True|False"
    Font-Italic="True|False"
    Font-Names="string"
    Font-Overline="True|False"
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
                Large|X-Large|XX-Large"
        Font-Strikeout="True|False"
    Font-Underline="True|False"
    ForeColor="color name|#dddddd"
    HeaderText="string"
    Height="size"
    HelpPageIconUrl="uri"
    HelpPageText="string"
    HelpPageUrl="uri"
    ID="string"
    InstructionText="string"
    InvalidAnswerErrorMessage="string"
      InvalidEmailErrorMessage="string"
    InvalidPasswordErrorMessage="string"
    InvalidQuestionErrorMessage="string"
    LoginCreatedUser="True|False"
    MailDefinition-BodyFileName="uri"
    MailDefinition-CC="string"
    MailDefinition-From="string"
    MailDefinition-IsBodyHtml="True|False"
    MailDefinition-Priority="Normal|Low|High"
    MailDefinition-Subject="string"
    MembershipProvider="string"
    OnActiveStepChanged="ActiveStepChanged event handler"
    OnCancelButtonClick="CancelButtonClick event handler"
    OnContinueButtonClick="ContinueButtonClick event handler"
    OnCreatedUser="CreatedUser event handler"
    OnCreateUserError="CreateUserError event handler"
    OnCreatingUser="CreatingUser event handler"
    OnDataBinding="DataBinding event handler"
    OnDisposed="Disposed event handler"
    OnFinishButtonClick="FinishButtonClick event handler"
    OnInit="Init event handler"
    OnLoad="Load event handler"
    OnNextButtonClick="NextButtonClick event handler"
    OnPreRender="PreRender event handler"
    OnPreviousButtonClick="PreviousButtonClick event handler"
    OnSendingMail="SendingMail event handler"
    OnSendMailError="SendMailError event handler"
    OnSideBarButtonClick="SideBarButtonClick event handler"
    OnUnload="Unload event handler"
    PasswordHintText="string"
    PasswordLabelText="string"
    PasswordRegularExpression="string"
    PasswordRegularExpressionErrorMessage="string"
    PasswordRequiredErrorMessage="string"
    Question="string"
    QuestionLabelText="string"
    QuestionRequiredErrorMessage="string"
    RequireEmail="True|False"
    runat="server"
    SkinID="string"
    SkipLinkText="string"
    StartNextButtonImageUrl="uri"
    StartNextButtonText="string"
    StartNextButtonType="Button|Image|Link"
    StepNextButtonImageUrl="uri"
    StepNextButtonText="string"
    StepNextButtonType="Button|Image|Link"
    StepPreviousButtonImageUrl="uri"
    StepPreviousButtonText="string"
    StepPreviousButtonType="Button|Image|Link"
    Style="string"
    TabIndex="integer"
    ToolTip="string"
    UnknownErrorMessage="string"
    UserName="string"
    UserNameLabelText="string"
    UserNameRequiredErrorMessage="string"
    Visible="True|False"
    Width="size"
>
          <CancelButtonStyle/>
        <CompleteSuccessTextStyle/>
        <ContinueButtonStyle/>
        <CreateUserButtonStyle/>
        <ErrorMessageStyle/>
        <FinishCompleteButtonStyle/>
        <FinishNavigationTemplate>
            <!-- child controls -->
        </FinishNavigationTemplate>
        <FinishPreviousButtonStyle/>
        <HeaderStyle/>
        <HeaderTemplate>
            <!-- child controls -->
        </HeaderTemplate>
        <HyperLinkStyle/>
        <InstructionTextStyle/>
        <LabelStyle/>
        <MailDefinition
            BodyFileName="uri"
            CC="string"
            From="string"
            IsBodyHtml="True|False"
            Priority="Normal|Low|High"
            Subject="string"
>
                <EmbeddedObjects>
                        <asp:EmbeddedMailObject
                            Name="string"
                            Path="uri"
                        />
                </EmbeddedObjects>
        </MailDefinition>
        <NavigationButtonStyle/>
        <NavigationStyle/>
        <PasswordHintStyle/>
        <SideBarButtonStyle/>
        <SideBarStyle/>
        <SideBarTemplate>
            <!-- child controls -->
        </SideBarTemplate>
        <StartNavigationTemplate>
            <!-- child controls -->
        </StartNavigationTemplate>
        <StartNextButtonStyle/>
        <StepNavigationTemplate>
            <!-- child controls -->
        </StepNavigationTemplate>
        <StepNextButtonStyle/>
        <StepPreviousButtonStyle/>
        <StepStyle/>
        <TextBoxStyle/>
        <TitleTextStyle/>
        <ValidatorTextStyle/>
        <WizardSteps>
                <asp:TemplatedWizardStep
                    AllowReturn="True|False"
                    ContentTemplateContainer="string"
                    EnableTheming="True|False"
                    EnableViewState="True|False"
                    ID="string"
                    OnActivate="Activate event handler"
                    OnDataBinding="DataBinding event handler"
                    OnDeactivate="Deactivate event handler"
                    OnDisposed="Disposed event handler"
                    OnInit="Init event handler"
                    OnLoad="Load event handler"
                    OnPreRender="PreRender event handler"
                    OnUnload="Unload event handler"
                    runat="server"
                    SkinID="string"
                    StepType="Auto|Complete|Finish|Start|Step"
                    Title="string"
                    Visible="True|False"
>
                        <ContentTemplate>
                            <!-- child controls -->
                        </ContentTemplate>
                        <CustomNavigationTemplate>
                            <!-- child controls -->
                        </CustomNavigationTemplate>
                </asp:TemplatedWizardStep>
                <asp:WizardStep
                    AllowReturn="True|False"
                    EnableTheming="True|False"
                    EnableViewState="True|False"
                    ID="string"
                    OnActivate="Activate event handler"
                    OnDataBinding="DataBinding event handler"
                    OnDeactivate="Deactivate event handler"
                    OnDisposed="Disposed event handler"
                    OnInit="Init event handler"
                    OnLoad="Load event handler"
                    OnPreRender="PreRender event handler"
                    OnUnload="Unload event handler"
                    runat="server"
                    SkinID="string"
                    StepType="Auto|Complete|Finish|Start|Step"
                    Title="string"
                    Visible="True|False"
                />
        </WizardSteps>
</asp:CreateUserWizard>

Remarks

The CreateUserWizard control provides the user interface for the MembershipProvider object that communicates with the user account data store for your Web site to create new user accounts in the data store. The CreateUserWizard relies on the MembershipProvider to create, authenticate, and disable user accounts. For more information on using the CreateUserWizard control and other ASP.NET login controls, see ASP.NET Login Controls Overview.

Example

The following code example shows how to use the CreateUserWizard control with the default templates. This page will create new Web site user account with the default MembershipProvider object for the site.

Security noteSecurity Note

This control has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

<%@ page language="VB"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>CreateUserWizard sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:createuserwizard id="Createuserwizard1" runat="server">
        <wizardsteps>
          <asp:createuserwizardstep runat="server" title="Sign Up for Your New Account">
            <contenttemplate>
              <table border="0">
                <tr>
                  <td>
                    <table border="0" style="height: 100%; width: 100%;">
                      <tr>
                        <td align="center" colspan="2">
                          Sign Up for Your New Account</td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="UserName" id="UserNameLabel">
                            User Name:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" id="UserName"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="UserName" tooltip="User Name is required."
                            id="UserNameRequired" validationgroup="Createuserwizard1" errormessage="User Name is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="Password" id="PasswordLabel">
                            Password:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" textmode="Password" id="Password"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="Password" tooltip="Password is required."
                            id="PasswordRequired" validationgroup="Createuserwizard1" errormessage="Password is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="ConfirmPassword" id="ConfirmPasswordLabel">
                            Confirm Password:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" textmode="Password" id="ConfirmPassword"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="ConfirmPassword" tooltip="Confirm Password is required."
                            id="ConfirmPasswordRequired" validationgroup="Createuserwizard1" errormessage="Confirm Password is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="Email" id="EmailLabel">
                            Email:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" id="Email"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="Email" tooltip="Email is required."
                            id="EmailRequired" validationgroup="Createuserwizard1" errormessage="Email is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="Question" id="QuestionLabel">
                            Security Question:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" id="Question"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="Question" tooltip="Security question is required."
                            id="QuestionRequired" validationgroup="Createuserwizard1" errormessage="Security question is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="Answer" id="AnswerLabel">
                            Security Answer:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" id="Answer"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="Answer" tooltip="Security answer is required."
                            id="AnswerRequired" validationgroup="Createuserwizard1" errormessage="Security answer is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="center" colspan="2">
                          <asp:comparevalidator runat="server" display="Dynamic" errormessage="The Password and Confirmation Password must match."
                            controltocompare="ConfirmPassword" controltovalidate="Password" id="PasswordCompare"
                            validationgroup="Createuserwizard1">
                          </asp:comparevalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="center" colspan="2" style="color: Red;">
                          <asp:literal runat="server" enableviewstate="False" id="FailureText">
                          </asp:literal>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </contenttemplate>
          </asp:createuserwizardstep>
          <asp:completewizardstep runat="server" title="Complete">
            <contenttemplate>
              <table border="0">
                <tr>
                  <td>
                    <table border="0" style="height: 100%; width: 100%;">
                      <tr>
                        <td align="center" colspan="2">
                          Complete</td>
                      </tr>
                      <tr>
                        <td>
                          Your account has been successfully created.</td>
                      </tr>
                      <tr>
                        <td align="right" colspan="2">
                          <asp:button runat="server" validationgroup="Createuserwizard1" commandname="Continue"
                            id="ContinueButton" causesvalidation="False" text="Continue" />
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </contenttemplate>
          </asp:completewizardstep>
        </wizardsteps>
      </asp:createuserwizard>
    </div>
    </form>
</body>
</html>
<%@ page language="C#"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>CreateUserWizard Sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:createuserwizard id="Createuserwizard1" runat="server">
        <wizardsteps>
          <asp:createuserwizardstep runat="server" title="Sign Up for Your New Account">
            <contenttemplate>
              <table border="0">
                <tr>
                  <td>
                    <table border="0" style="height: 100%; width: 100%;">
                      <tr>
                        <td align="center" colspan="2">
                          Sign Up for Your New Account</td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="UserName" id="UserNameLabel">
                            User Name:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" id="UserName"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="UserName" tooltip="User Name is required."
                            id="UserNameRequired" validationgroup="Createuserwizard1" errormessage="User Name is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="Password" id="PasswordLabel">
                            Password:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" textmode="Password" id="Password"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="Password" tooltip="Password is required."
                            id="PasswordRequired" validationgroup="Createuserwizard1" errormessage="Password is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="ConfirmPassword" id="ConfirmPasswordLabel">
                            Confirm Password:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" textmode="Password" id="ConfirmPassword"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="ConfirmPassword" tooltip="Confirm Password is required."
                            id="ConfirmPasswordRequired" validationgroup="Createuserwizard1" errormessage="Confirm Password is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="Email" id="EmailLabel">
                            Email:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" id="Email"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="Email" tooltip="Email is required."
                            id="EmailRequired" validationgroup="Createuserwizard1" errormessage="Email is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="Question" id="QuestionLabel">
                            Security Question:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" id="Question"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="Question" tooltip="Security question is required."
                            id="QuestionRequired" validationgroup="Createuserwizard1" errormessage="Security question is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="right">
                          <asp:label runat="server" associatedcontrolid="Answer" id="AnswerLabel">
                            Security Answer:</asp:label></td>
                        <td>
                          <asp:textbox runat="server" id="Answer"></asp:textbox>
                          <asp:requiredfieldvalidator runat="server" controltovalidate="Answer" tooltip="Security answer is required."
                            id="AnswerRequired" validationgroup="Createuserwizard1" errormessage="Security answer is required.">
                            *</asp:requiredfieldvalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="center" colspan="2">
                          <asp:comparevalidator runat="server" display="Dynamic" errormessage="The Password and Confirmation Password must match."
                            controltocompare="ConfirmPassword" controltovalidate="Password" id="PasswordCompare"
                            validationgroup="Createuserwizard1">
                          </asp:comparevalidator>
                        </td>
                      </tr>
                      <tr>
                        <td align="center" colspan="2" style="color: Red;">
                          <asp:literal runat="server" enableviewstate="False" id="FailureText">
                          </asp:literal>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </contenttemplate>
          </asp:createuserwizardstep>
          <asp:completewizardstep runat="server" title="Complete">
            <contenttemplate>
              <table border="0">
                <tr>
                  <td>
                    <table border="0" style="height: 100%; width: 100%;">
                      <tr>
                        <td align="center" colspan="2">
                          Complete</td>
                      </tr>
                      <tr>
                        <td>
                          Your account has been successfully created.</td>
                      </tr>
                      <tr>
                        <td align="right" colspan="2">
                          <asp:button runat="server" validationgroup="Createuserwizard1" commandname="Continue"
                            id="ContinueButton" causesvalidation="False" text="Continue" />
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </contenttemplate>
          </asp:completewizardstep>
        </wizardsteps>
      </asp:createuserwizard>
    </div>
    </form>
</body>
</html>

See Also

Reference

ASP.NET Login Controls Overview
CreateUserWizard
TemplatedWizardStep