Use ASP.NET to Setup User Accounts on Your Website

Page content

Using Microsoft Visual Web Developer

Website user accounts in ASP.NET form are developed using either Visual Studio or Microsoft Visual Web Developer, with the 2005 or 2008 Express editions, both of which are free. Using the Visual Web Developer Express software, start by opening the program and clicking on File, New Website. This brings up a choice of installed templates, the first of which is an ASP.NET Website. Select this template and provide a folder and name in the location box. Click on OK and starter code using Visual Basic will appear.

The easiest way to setup user accounts is through the Design view in ASP.NET (select at the bottom of the screen). Don’t be confused by what Microsoft labels as the “Start” page. This is just an update news service from Microsoft and can be ignored or closed for the purpose of this project. Along the left edge of the window you will see choices for the Toolbox, CSS properties, and a Manage (CSS) style. For basic development of user account administration only the Toolbox will be used. Clicking on this will bring up a list of visual controls that can be inserted into the user web pages.

Configuring Membership Access

Before getting into design though, you need to configure the site for membership access. Do this through a choice on the menu at the top of the page. Click on Website. At the bottom of the pulldown menu choose ASP.NET Configuration. This provides access to the ASP.NET Website Administration Tool. This is where the settings are created to provide user account administration. Note: Depending on your firewall settings or other security methods on your own PC, you may need to setup access to the initial user account administration tool screen. Normally this tool appears without a problem through a localhost page, but if it doesn’t, then access needs to be permitted.

Select the Security tab. Before adding user information, an important choice has to be made. If this user system is being created for an Intranet, then it needs to be set up to authenticate users using the Windows authentication process. If hosting on an Internet site, then the security uses forms-based authentication. Selecting this is done from the link named Select authentication type. Once you make this choice and click Done, the security page returns. On this page under the Users section are options to setup user accounts by creating or managing users. With these links you can begin to add user account information including names, passwords, email and a security question. Once users are added, a special database named ASPNETDB.MDF is created.

Initial Files Created

Once these initial steps are finished, the Solution Explorer on the right site of the screen (click on View and Solution Explorer if it isn’t visible), will display several folders and files. The database is found in the App_Data folder. Drilling down in this database should show the tables and information that you created in the preceding step. The web.config file holds all the information about the website that was created automatically, including the authentication type. It can be editing directly, although the process is much easier using the Website Administration Tool.

The next article in this series describes using the Toolbox to create pages for website user accounts that allow the user to login or create a new account (register) and provide a means to use JMail to send email registration confirmation to the new user. Future articles will expand on using images on your user account pages.

This post is part of the series: 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.

  1. Set Up User Registration and Log In Pages with ASP.Net
  2. How to Create and Manage User Accounts with ASP.Net