Personalization Using Visual Basic 2005 - Creating the User Through IIS
(Page 2 of 6 )
As an alternative to using the WAT, you can work through IIS to create the same effect.
To begin, create an new empty directory calledFormsBasedSecurityIIS.
In IIS manager (accessed through the control panel), create a virtual directory namedFormsBasedSecurityIIS, as shown in Figure 12-4.

Figure 12-4. Creating virtual directory
Give the new virtual directory the alias “FormsBasedSecurityIIS” and on the second step of the wizard, browse to the physicalFormsBasedSecurityIIS folder you just created. After the virtual directory is created, click Properties.
In the Properties window, click on the ASP.NET tab, and then click Edit Configuration. Within the Configuration settings dialog, click on the Authentication tab. Within that tab, set the Authentication mode toForms, as shown in Figure 12-5. Confirm that the Membership provider class is set toAspNetSqlMembershipProvider.

Figure 12-5. Set Authentication mode to Forms
Click OK to close all the dialogs. A Web.config file is created for you in theFormsBasedSecurityIISdirectory, as shown in Example 12-1.
Example 12-1. Web.config file generated
<?xml version="1.0" encoding="utf-8"?> <configuration xmlns="http://schemas.microsoft.com/
.NetConfiguration/v2.0">
<system.web>
<authentication mode="Forms" />
</system.web>
</configuration>
ASP.NET 2.0 Forms-built security is built on a set of tables that must be created in your database: typically SQL Server or SQL Server Express. Fortunately, ASP.NET provides a utility named aspnet_regsql.exe, located in the <Drive:>\Windows\ Microsoft.NET\Framework\<versionNumber> folder on your web server, which sets up the tables for you. This utility program will create the required database and all its tables.
The easiest way to use this utility is to run aspnet_regsql.exe from the .NET command box, with no arguments. A wizard will walk you through the process. For more details, see the MSDN article “Installing the SQL Server Provider Database.”
You are now ready to create a new web site in the same location. A dialog box will warn you that you already have a web site in that location; choose Open Existing Site, as shown in Figure 12-6.

Figure 12-6. Open existing site
This instructs Visual Studio to use the site you’ve created, complete with the Web. config file already available for that site.
Next: Creating Accounts Programatically >>
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.
|
|