Personalization Using Visual Basic 2005
(Page 1 of 6 )
Personalizing a web site involves adding a variety of features to suit both the needs of the user and the site owner -- such as restricting some areas of a site and/or allowing users to register and log in. This article shows you how to personalize a site using Visual Basic 2005. It is excerpted from chapter 12 of the book
Programming Visual Basic 2005, written by Jesse Liberty (O'Reilly, 2005; ISBN: 0596009496).
One of the hallmarks of a professional web site is the ability for users to personalize the site to their individual needs. Personalization means that the site remembers the user and the user’s preferences, profile information, and so forth.
In addition to allowing users to personalize your site, you may want to limit their access based on their identity. To accomplish this, you may want your users to “log in.” While you can use Windows security on an intranet, the harder task has always been to create a complete authentication and authorization system for Internet applications where you can’t know in advance who will be logging in. This is called forms-based security, and Visual Basic 2005 makes it a snap, with a ready-to-go set of controls and a complete database for managing both your users login information and their preferences.
Implementing Forms-Based Security To begin, create a new web application named FormsBasedSecurity. Click on Web-Site -> ASP.NET Configuration to open the Web Site Administration Tool (WAT). Click on the Security tab, as shown in Figure 12-1.
Under Users, click on the link “Select authentication” and choose “From the Internet” as opposed to “From a local network.” Then click the Done button. When you return to the Security tab, you’ll find that the Users section has changed considerably, as shown in Figure 12-2.
Click on Create User and create one user for your site, as shown in Figure 12-3.

Figure 12-1. Web Site Administration Tool

Figure 12-2. User's section
By default, passwords must be “strong,” which is defined as having at least six characters and including at least one element of at least three of the four types of characters: English upper case, English lower case, Arabic numerals, and special characters (e.g., !, @, etc.). This is fully documented in the MSDN article “Strong Password Enforcement.”
TheCreateUserWizardhas aPasswordRegularExpressionproperty that allows you to substitute your own regular expression to determine the characteristics of acceptable passwords.
When you click the Create User button, you will receive confirmation that the user has been created. Click the Back button and you are returned to the WAT, which reports faithfully that one user has been created. Close the WAT for now.
The user has been added to the SqlExpress personalization database, as we’ll explore in depth next. For an alternative approach, using IIS rather than the WAT, see the section “Creating the User Through IIS.”

Figure 12-3. Creating the first user
Next: Creating the User Through IIS >>
More Visual Basic.NET Articles
More By O'Reilly Media
|
This article is excerpted from chapter 12 of the book Programming Visual Basic 2005, written by Jesse Liberty (O'Reilly, 2005; ISBN: 0596009496). Check it out today at your favorite bookstore. Buy this book now.
|
|