System.Web.UI.WebControls.CreateUserWizard Class

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

See Also: CreateUserWizard Members

Syntax

[System.ComponentModel.Bindable(false)]
public class CreateUserWizard : Wizard

Remarks

In this topic:

Introduction

The System.Web.UI.WebControls.CreateUserWizard control provides the user interface for the System.Web.Security.MembershipProvider object that communicates with your Web site's user data store to create new user accounts in the data store. The System.Web.UI.WebControls.CreateUserWizard relies on the System.Web.Security.MembershipProvider to create the user and disable them if necessary.

Note:

If you are not familiar with ASP.NET login controls, you might find it helpful to read ASP.NET Login Controls Overview before continuing. For a list of other topics related to login controls and membership, see Managing Users By Using Membership.

By default, the System.Web.UI.WebControls.CreateUserWizard control will accept a user name and password from the Web site visitor. Based on the requirements of the site's System.Web.Security.MembershipProvider object, the System.Web.UI.WebControls.CreateUserWizard control will optionally accept an e-mail address, represented by the CreateUserWizard.Email property, and a password recovery confirmation question and answer, represented by CreateUserWizard.Question and CreateUserWizard.Answer. For a table showing all required and optional controls for System.Web.UI.WebControls.CreateUserWizard, see CreateUserWizard.CreateUserStep.

Note:

If CreateUserWizard.AutoGeneratePassword is set to true and the System.Web.Security.Membership.PasswordStrengthRegularExpression property is set in the application's Web.config file, you could potentially generate a password that does not pass the regular expression strength test. In this case, creating a user raises an error that indicates an invalid password.

Creating a User

When a user is created with the System.Web.UI.WebControls.CreateUserWizard, the control interacts with the current CreateUserWizard.MembershipProvider to accomplish the following tasks in order.

[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]

You can extend the System.Web.UI.WebControls.CreateUserWizard control to accept additional information by adding additional fields, or by adding additional steps before or after the provided templates in the CreateUserWizard.CreateUserStep and CreateUserWizard.CompleteStep properties.

Note:

The System.Web.UI.WebControls.CreateUserWizardStep step is the first step within the System.Web.UI.WebControls.CreateUserWizard control, and is a required step. By default, the CreateUserWizardStep.AllowReturn property is set to false to keep the user from returning to the System.Web.UI.WebControls.CreateUserWizardStep step and accidentally attempting to create another user account with the same credentials. If System.Web.UI.Control.EnableViewState is set to false, the CreateUserWizardStep.AllowReturn property is not maintained in view state and you must include logic in your application to maintain the CreateUserWizardStep.AllowReturn value.

System.Web.UI.WebControls.CreateUserWizard control properties represented by text boxes, such as CreateUserWizard.UserName, are accessible during all phases of the page life cycle. The control will pick up any changes made by the end user by means of the TextBox.TextChanged event raised by the text boxes.

The System.Web.UI.WebControls.CreateUserWizard control can optionally send e-mail messages to new users if you have configured an SMTP mail server to send e-mail. For more information, see the CreateUserWizard.MailDefinition property.

Note:

The System.Web.UI.WebControls.CreateUserWizard control uses Internet e-mail services to send login information to users. There are inherent security risks with sending passwords in e-mail. You should determine whether these security risks are acceptable to your site.

Styles and Templates

When the System.Web.UI.WebControls.CreateUserWizard control is not customized with templates, the WebControl.AccessKey property of the System.Web.UI.WebControls.CreateUserWizard control applies to the first text box in the control and the WebControl.TabIndex property, which is applied to all text boxes of the control. If the System.Web.UI.WebControls.CreateUserWizard control is customized with templates, then the WebControl.AccessKey property and the WebControl.TabIndex property are ignored. In this case, directly set the WebControl.AccessKey property and the WebControl.TabIndex property of each template child control.

System.Web.UI.WebControls.CreateUserWizard control properties represented by text boxes, such as CreateUserWizard.UserName and CreateUserWizard.Password, are accessible during all phases of the page life cycle. The control will pick up any changes made by the end user by means of the TextBox.TextChanged event raised by the text boxes.

Note:

Setting the CreateUserWizard.AutoGeneratePassword, CreateUserWizard.MembershipProvider, or CreateUserWizard.RequireEmail property recreates the child controls of the System.Web.UI.WebControls.CreateUserWizard control, and their control state is lost in the process. To avoid this situation, explicitly maintain the control state of the System.Web.UI.WebControls.CreateUserWizard control's child controls, or avoid putting controls inside of templates.

The following table lists the System.Web.UI.WebControls.CreateUserWizard control style properties and explains which UI element each style property affects. For a list of which properties each style applies to, see the documentation for the individual style properties.

CreateUserWizard.ContinueButtonStyle

Continue button.

CreateUserWizard.CreateUserButtonStyle

Create User button.

CreateUserWizard.HyperLinkStyle

Links to other pages.

CreateUserWizard.InstructionTextStyle

Instructional text on the page that tells users how to use the control.

CreateUserWizard.LabelStyle

Labels for all input fields, such as text boxes.

CreateUserWizard.TextBoxStyle

Text entry input fields.

CreateUserWizard.TitleTextStyle

Title text for each view.

CreateUserWizard.CompleteSuccessTextStyle

Text displayed to the user when the password recovery or reset attempt is successful.

CreateUserWizard.ErrorMessageStyle

Error messages when the membership provider fails to create a new user account.

CreateUserWizard.PasswordHintStyle

The text that describes password requirements.

CreateUserWizard.ValidatorTextStyle

Error messages associated with validation.

Validation Grouping

The System.Web.UI.WebControls.CreateUserWizard control uses a validation group so that other fields on the same page as the System.Web.UI.WebControls.CreateUserWizard control can be validated separately. By default, the System.Web.UI.Control.ID property of the System.Web.UI.WebControls.CreateUserWizard control is used as the name of the validation group. For example, a System.Web.UI.WebControls.CreateUserWizard control with the ID "CreateUserWizard1" will use a validation group name of "CreateUserWizard1". If you want to set the validation group that the System.Web.UI.WebControls.CreateUserWizard control is part of, you must template the control and change the validation group name.

Note that the System.Web.UI.WebControls.CreateUserWizard class inherits from the System.Web.UI.WebControls.Wizard class, which does not support special Microsoft Internet Explorer rendering for non-standard or quirks mode. The System.Web.UI.WebControls.CreateUserWizard does not attempt to optimize rendering for non-standard Internet Explorer mode. To get the best Internet Explorer rendering using the System.Web.UI.WebControls.CreateUserWizard control, use the XHTML doc type, which is added by default in Visual Web Developer and Visual Studio.

Formatting Using Layout Templates

The System.Web.UI.WebControls.CreateUserWizard control lets you specify the layout of the control without requiring you to use an HTML table element. Instead, you can use a LayoutTemplate element to specify the layout. In the layout template, you create placeholder controls to indicate where items should be dynamically inserted into the control. (This is similar to how the template model for the System.Web.UI.WebControls.ListView control works.) For more information, see the Wizard.LayoutTemplate property.

Accessibility

For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.

Declarative Syntax

Example

<asp:CreateUserWizard
    AccessKey="string"
    ActiveStepIndex="integer"
    Answer="string"
    AnswerLabelText="string"
    AnswerRequiredErrorMessage="string"
    AutoGeneratePassword="True|

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0