Setting up wwebsite user accounts to let users create their own accounts, choose user IDs and passwords, retrieve lost passwords, and receive notifications of registration can be done with little effort using ASP.Net built-in wizards.
The first article in this series described how to setup user accounts using ASP.Net, focusing on configuring the website to accept and store information for a user database. The next step is to create the screens that will let users Log In or create a new account and perform other account management on their own.
Visual Web Developer Express
If you do not own Microsoft Visual Studio you can still do this work with Microsoft’s free Visual Web Developer Express (VWDE). The current version is 2008, but 2005 will work just as well. To gain experience with this tool, start by creating several user accounts for yourself. After setting up the main process following directions in “How to Create and Management User Accounts With ASP.Net," open the ASP.Net Configuration choice on the menu items at the top of the screen. Pull down the “website" heading and use the last item on the list, the configuration option.
Create Users Manually
Once you have the configuration tool open, choose the “Security" option, then click “Create user." You will start by creating an administrative user. In the box that opens, enter a user name, password and email address for your administrator account. Also create a security question and answer that will allow recovery of the password. Move from here to the “Roles" box and select “Administrators." Finish this step by clicking “Create User" again, then close the administration tool. At this point you could repeat this process to add other users if desired.
Set Up Account Creation Pages for Users
Since you want remote users to be able to create their own account, it will be necessary to build a special webpage for user account administration. Start that process by making a new webpage and naming it something like “CreateAccount.aspx." Using the “Design" view (selected at the bottom of the page) a toolbox should be visible in the left column. If not, select it from the “View" menu. Within the Toolbox, under a “Login" section (expand this by clicking on the + sign), click and drag the “CreateUserWizard" onto the site form. This starts the wizard and creates a user sign in box with all needed information. If you test the page now by running the code (press Ctrl+ F5) and follow through creating an account you should see a “Continue" button appear. This will not do anything until code is added to that button to move to a page, which will have to be created, to confirm account creation by redirecting the user to the main webpage.
Create a Log In Screen
The account Log In page can be combined with the main website page if desired or mounted separately. The CreateUserWizard control can be customized by using the Properties window found on the right of the screen. Choose colors, fonts, borders, labels, etc. and add special instructions, for example, password rules. A direct Log In page is created in the same fashion, by dragging the control named “Login" from the Toolbox onto the Design page. The same kinds of customization options are available for this item and several have been set to show possibilities in the image.
The next article in this series will cover enhancements for website user accounts such as a Log Out option and how to create an automatic email to a user that will confirm registration and, at your option, first create a temporary password included in the notification email instead of letting the user choose from the setup account screen.
Using ASP.Net to Create and Manager User Accounts
Anyone who desires to restrict access to their webpage(s) but allow some users probably will need to develop a process to register users with account names and passwords. While there are a multutude of ways to accomplish this, wizards in ASP.Net can simplify the process.
- Set Up User Registration and Log In Pages with ASP.Net
- How to Create and Manage User Accounts with ASP.Net