Learn How to use the CreateUserWizard control in ASP.NET 3.5 C#

Category: ASP.NET

This tutorial will demonstrate how to use the CreateUserWizard control in ASP.NET 3.5 Web App C#.

In this tutorial we will add a user account to the database using ASP.NET framework through the CreateUserWizard control. This allows users to add their own information to the user database and force them to sign up for accounts.

Here is a snapshot of what CreateUserWizard should look like when this application executes:

Need help with Windows Dedicated Hosting? Try Server Intellect I'm a happy customer!

The CreateUserWizard control renders a user registration form. It’s pretty simple. If the user submits the form successfully, then a new user is added to your Web site. This is a powerful control considering that the CreateUserWizard control uses ASP.NET membership to create the new user.

The CreateUserWizard control supports an extensive number of properties which enables you to modify the appearance and behavior of this control. For instance, the following code block uses several of the CreateUserWizard properties to customize the appearance of the form rendered by the control.




 ID="CreateUserWizard1"
 ContinueDestinationPageUrl="~/Default.aspx"

 CompleteSuccessText="Your account has been created! Thank you for registering"
 CssClass="createUser"
 TitleTextStyle-CssClass="createUser_title"
 InstructionTextStyle-CssClass="createUser_instructions"
 CreateUserButtonStyle-CssClass="createUser_button"
 ContinueButtonStyle-CssClass="createUser_button" runat="server">
 ID="CreateUserWizardStep1" runat="server">






Notice that the control’s ContinueDestinationPageUrl property is set to the value "~/Default.aspx”. This way after you register you immediately get redirected to the "~/Default.aspx”.

By default the CreateUserWizard control create the following form fields by default:

Username, Password, Confirm Password, Email, Security Question, Security Answer

These are optional:

Email, Security Question, Security Answer

If you're looking for a really good web host, try Server Intellect - we found the setup procedure and control panel, very easy to adapt to and their IT team is awesome!

Let’s say that you do not wish for the user to enter either an email address or a secuirty question and answer. In this case you must modify the configuration fiel of the default membership provider. The web configuration file makes both email address and security question and answer optional. Let’s take a closer look:





 type="System.Web.Security.SqlMembershipProvider"
 connectionStringName="LocalSqlServer"
 requiresQuestionAndAnswer="false"

 requiresUniqueEmail="false"/>

If you add the code block above to your application, then the CreateuerWizard control will not render the security question and answer field. However, the control will still render an email field. If you do not wish to have an email field then add this code below to the membership defaultProvider accordingly:

RequireEmail=”false”

You can also format this control with Cascading Style Sheets. Below is an example of some CSS classes that we used:

We migrated our web sites to Server Intellect over one weekend and the setup was so smooth that we were up and running right away. They assisted us with everything we needed to do for all of our applications. With Server Intellect's help, we were able to avoid any headaches!



Download Project Source - Enter your Email to be emailed a link to download the Full Source Project used in this Tutorial!



100% SPAM FREE! We will never sell or rent your email address!