Customizing the ASP.NET CreateUserWizard Control

May 29, 2009 16:54 by XeroOne

This is part two in a two part series on customizing the ASP.NET CreateUserWizard control.  To read part one, click here.

So far we've gotten the control built and we're able to create a user.  That's great, but for practical uses, we need to get a little bit more information about the user.

We're going to customize the <asp:CreateUserWizard/> control, using ASP.NET Profile provider and gather the users' name and address.  Let's look at the code:

[REMAINDER OF THIS POST WILL BE PUBLISHED SOON] 

UPDATE (6/22/2009): We appologize for the delay in updating this post

After re-evaluating the customizations we needed to perform in order to get the <asp:CreateUserWizard/> control to perform as we required, we have decided to abandon the use of this control for this project altogehter. 

We recognize the extream usefulness of this control in most scenarios, however, our requirements for the control are not currently supported by this control.  In the future we may choose to  post an additional tutorial for customizing the wizard steps involved for this control, and we will link this tutorial with part one.  For now this tutorial is closed. 

Sorry for the inconvenience.

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   , ,
Categories:       ASP.NET Membership
Links:   Permalink | Comments (1) | Comment RSSRSS comment feed
Actions:   Email this article | del.icio.us | Digg it! | StumbleUpon | DZone it! | reddit | /. | Kick it!

Customizing the ASP.NET CreateUserWizard Control

May 29, 2009 12:10 by XeroOne
ASP.NET CreateUserWizard

The <asp:CreateUserWizard /> control is another ASP.NET 2.0 feature that allows a web developer to quickly build a user registration form.

There are several ways to customize this control.  The default settings are shown here.  This article will cover how to customize both the opperation and the style of this control. 

 First, let's look at the code used to build this, and the web.config settings:

ASPX page
<asp:CreateUserWizard id="CreateUserWizard1" runat="server">
    <wizardSteps>
        <asp:CreateUserWizardStep id="CreateUserWizardStep1" runat="server">
        </asp:CreateUserWizardStep>
        <asp:CompleteWizardStep id="CompleteWizardStep1" runat="server">
        </asp:CompleteWizardStep>
    </wizardSteps>
</asp:CreateUserWizard> 

Web.Config
<membership defaultProvider="AspNetSqlMembershipProvider">
    <providers>
    <clear />
    <add name="AspNetSqlMembershipProvider"
       connectionStringName="connectionString"
       enablePasswordRetrieval="true"
       enablePasswordReset="true"
       requiresQuestionAndAnswer="true"
       applicationName="XeroOne"
       requiresUniqueEmail="true"
       passwordFormat="Hashed"
       maxInvalidPasswordAttempts="5"
       minRequiredPasswordLength="6"
       minRequiredNonalphanumericCharacters="0"
       passwordAttemptWindow="10"
       passwordStrengthRegularExpression=""
       type="System.Web.Security.SqlMembershipProvider"/>
  </providers>
</membership>

If you're not planning on allowing the user's to reset their own passwords, or to use an "I forgot" function, then you won't need to ask for a security question and answer.  These fields are easily removed by changing the web.config settings.

Web.Config
enablePasswordRetrieval="false"
enablePasswordReset="false"
requiresQuestionAndAnswer="false"

You can also force the users to create a strong password by requiring a specific number of symbols in the password (minRequiredNonalphanumericCharacters), or optionally use a regular expression (passwordStrengthRegularExpression) to specify the user must enter at least one uppercase letter, one number, and one symbol.

Next, let's make this control blend in a little better with our site's theme, and change some of the messages.

ASPX page
<asp:CreateUserWizard id="CreateUserWizard1" runat="server"
         invalidPasswordErrorMessage="Password must be at least 6 characters.">
     <titleTextStyle CssClass="wizardTitle" />
     <labelStyle CssClass="wizardLabel" />
     <continueButtonStyle CssClass="wizardButton" />
     <createUserButtonStyle CssClass="wizardButton" />
     <wizardSteps>
         <asp:CreateUserWizardStep id="CreateUserWizardStep1" runat="server" 
              title="Create a new user account"> 
         </asp:CreateUserWizardStep>
         <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
         </asp:CompleteWizardStep>
    </wizardSteps>
</asp:CreateUserWizard> 

I'm not forcing my users to register a strong password, so telling them they have to enter 0 alphanumeric characters seemed pointless. Use the InvalidPasswordErrorMessage property to change the message displayed to the user when their password doesn't meet your criteria. I also changed the title that instructs the user what they are doing usng the CreateUserWizardStep's Title property.

Customizing ASP.NET CreateUserWizard

I'm also using my style sheet to define how to display the title, the label that is next to each textbox, and the create user and continue buttons.  You haven't seen the continue button yet because it is the second step in the create user process.  The options are limitless with CSS, but in this example, I changed the text color, made the title bold, left aligned the label text, and added a background image to my button.

There are plenty of other options that allow you to change the text, messages, and styles of the rest of the control, but these are the ones I find myself changing most often.

Part 2 of this tutorial will go over creating additional fields and using the ASP.NET Profile provider.  

Read Part 2: Customizing the ASP.NET CreateUserWizard Control >

Currently rated 2.0 by 3 people

  • Currently 2/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   , , ,
Categories:       ASP.NET Membership | HTML & CSS
Links:   Permalink | Comments (0) | Comment RSSRSS comment feed
Actions:   Email this article | del.icio.us | Digg it! | StumbleUpon | DZone it! | reddit | /. | Kick it!

Creating ASP.NET Membership Tables

May 21, 2009 12:33 by XeroOne

The ASP.NET Membership provider makes it a peice of cake to add multiple user security to your web application.  There are a few steps involved to setting it up that aren't exactly obvious.  This article will explain how to creating the database tables and stored procedures in Microsoft SQL Server.

Open up a command prompt

Navigate to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\   

(the final directory may vary depending on your installation version of the .NET framework) 

The next step can be done in one of two ways.  You will be running the  AspNet_RegSql.exe utility.

To run in Wizzard mode simply run aspnet_regsql.exe and then follow the prompts to create your database

I prefer to automate this process.  To do so, all you need to do is provide the parameters to create the tables. They are as follows:
 
  • -E = Authenticates using the Windows credentials of the currently logged-in user. 

  • -S localhost = runs against the local installation of SQL Server.

  • -d database = specify the database name to run against

  • -A all = the A option stands for "add", and the all parameter means install all features (Membership, Role management, Profile, Web Parts personalization, Web events)

So the final command should come out looking like:

aspnet_regsql.exe -E -S localhost -d database -A all

 

That's it.  Refresh your database and you should see all the new tables and stored procedures that were automatically created.  

To read the documentation on using the aspnet_regsql.exe utility visit: http://msdn2.microsoft.com/library/x28wfk74(en-us,vs.80).aspx

The next step is using these features.  I'll cover that in our next article.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:       SQL Server | ASP.NET Membership
Links:   Permalink | Comments (0) | Comment RSSRSS comment feed
Actions:   Email this article | del.icio.us | Digg it! | StumbleUpon | DZone it! | reddit | /. | Kick it!

XeroOne's New Development Blog

May 20, 2009 15:43 by XeroOne

Well we've finally done it. 

It's been on the books for quite a while to implement a public facing blog for posting periodic web development articles, but our customer's priorities always come first.  So like the Shoemaker's son, our own website has gone barefoot.  But not anymore.

We hope to have enough content to be able to post weekly or bi-weekly articles here.  If you use an RSS reader for your news or entertainment, you can subscribe to our feed.  Our articles will cover a wide range of web development topics.  Starting with ASP.NET, C#, and Microsoft SQL Server as the foundation, we'll also talk about HTML & CSS, XML, AJAX, Javascript including tutorials and code samples for the various Javascript Frameworks (Mootools, JQuery, Prototype, Scriptaculous, Ext.JS, etc..), Our review of new web technologies, Rants and Raves about Micosoft products, and anything else we feel about writing about.

Just to give you a taste of what's in the pipeline, here's a brief list of the articles we have slated to write about over the next month:

  • Installing ASP.NET Membership functionality
  • Using ASP.NET Membership for site security
  • Triggering ASP.NET postbacks via Javascript routines
  • Quickly creating a database driven State selector (ASP.NET Drop Down List)
  • Getting started with Sub Sonic DAL Builder
  • Creating a fancy UI with Mootoos
  • CSS hacks for displaying to different browsers
  • Setting up POP & SMTP in Windows Server
  • and much more...

If you subscribe to our feed you'll automatically be notified when we create a new artcle, otherwise, just check back often!

Thanks for reading

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   , , ,
Categories:       General
Links:   Permalink | Comments (0) | Comment RSSRSS comment feed
Actions:   Email this article | del.icio.us | Digg it! | StumbleUpon | DZone it! | reddit | /. | Kick it!

About the Author

XeroOne Systems
This blog is dedicated to the various topics surrounding web development, specifically using ASP.NET, C#, MS SQL, HTML & CSS, XML, and the many JavaScript frameworks currently available (MooTools, JQuery, Scriptaculous, Prototype, Ext.Js, etc..)
Periodically we will share our knowledge and experience through this blog. We may post code samples, tips and tricks, shortcuts and workarounds, our reviews of new web technologies, and (from time to time) unrelated anecdotes.
Please contact us if you have an idea or suggestion you'd like us to write about. If you like what you've read, be sure to subscribe to our blog using your favorite RSS reader.

Latest Comments

Popular Tags