共用方式為


Web Site Administration Tool Provider Tab 

Use the Provider tab of the Web Site Administration Tool to manage how ASP.NET stores the data for application features, such as user accounts, roles, and other settings.

ASP.NET uses provider classes to manage data storage for various features, such as membership and role management. A provider class is a component that exposes specific ASP.NET functionality, such as managing user accounts in membership. Each of these application features requires data storage. Although each provider class performs the same application features, each provider class can store data in different ways. For example, different provider classes for ASP.NET membership might store user account information in the following different ways:

  • In a Microsoft SQL Server database.

  • In Microsoft Windows Active Directory directory service.

  • In a custom user database.

Each of these provider classes still performs the same core set of tasks for managing user accounts and you interact with the provider classes in your application in the same way.

Configuring Providers in the Web Site Administration Tool

The Web Site Administration Tool lets you use different provider classes for application features, such as membership and roles. ASP.NET is installed with several provider classes for each type of application feature. For example, ASP.NET has a provider class for membership that stores information in a SQL Server database (AspNetSqlMembershipProvider), and another that stores membership information in Active Directory.

Managing Provider Settings

You can use the Web Site Administration Tool to change and test providers for the Web site. Your application can use a single provider for application features or it can use several different providers.

By default, the Web Site Administration Tool uses the AspNetSqlProvider provider for all application features.

Use the Web Site Administration Tool to manage providers for the Web site in the following ways:

  • Change from the default AspNetSqlRoleProvider provider to the alternate AspNetWindowsTokenRoleProvider provider, if you would prefer to use local Windows groups for role authorization.

  • Specify whether to use the same provider for all application features or to use a different provider for each application feature. Generally, you select individual providers, only if you want precise control over where the information is stored or if you have to use a different provider for just one feature, such as roles.

Selecting a Single Provider vs. Different Providers

You can configure the Web site to use the same provider for all application features. In this case, all data for membership and roles and so on, is stored in a single data store (typically a single database). Alternatively, you can select a different provider for each application feature.

In the Web Site Administration Tool, on the Provider tab, your first choice is whether you want to use the same provider for all features or to select a provider individually for each application feature. You can choose the following options:

  • To specify a single provider for all application features, click Select a single provider for all site management data.

  • To specify providers for specific application features, click Select a different provider for each feature (advanced), and then select a provider for each application feature.

Configuring the SQL Server Provider

If you want to use the SQL Server provider to store application feature data in a SQL Server database, you must first configure SQL Server by creating the appropriate database. ASP.NET includes a command-line utility named aspnet_regsql.exe that performs this task for you.

The aspnet_regsql.exe executable is located in the WINDOWS\Microsoft.NET\Framework\versionNumber folder on the Web server. The aspnet_regsql.exe utility is used to both create the SQL Server database and add or remove options from an existing database.

You can run the aspnet_regsql.exe executable without any command-line arguments to run a wizard that will help you with specifying connection information for SQL Server and installing or removing the database elements for all supported features. You can also run the aspnet_regsql.exe executable as a command-line utility to configure database elements for individual features.

To run the aspnet_regsql.exe wizard, run the aspnet_regsql.exe executable without any command-line arguments, as shown in the following example.

[%system root%]\Microsoft.NET\Framework\versionNumber\aspnet_regsql.exe

To view online Help for additional options that are available with the aspnet_regsql.exe utility, use the /? option.

Behind the Scenes

The Provider tab manages configuration settings that are stored in the Web.config file for your application. Specifically, the settings that are managed through the Provider tab exist in the <membership> and <roleManager> sections of your configuration file.

The following code is the Web.config file that is generated by the Web Site Administration Tool after specifying that the AspNetWindowsTokenRoleProvider provider be used for role management.

<?xml version="1.0" encoding="utf-8"?>

<configuration>

<system.web>

<membership ``defaultProvider="AspNetSqlMembershipProvider"`` />

<roleManager enabled="true" ``defaultProvider="AspNetWindowsTokenRoleProvider"`` />

<authentication mode="Forms" />

</system.web>

</configuration>

More Information

For more information, see the following sections in the .NET Framework class reference and the ASP.NET Configuration Settings:

See Also

Concepts

Web Site Administration Tool Overview
Web Site Administration Tool Security Tab
Web Site Administration Tool Application Tab
Web Site Administration Tool Internals