You can set several types of options with the ASP.NET SQL Server Registration tool. You can specify a SQL connection, specify which ASP.NET application services use SQL Server to manage information, indicate which database or table is used for SQL cache dependency, and add or remove support for using SQL Server to store procedures and session state.
Several ASP.NET application services rely on a provider to manage storing and retrieving data from a data source. Each provider is specific to the data source. ASP.NET includes a SQL Server provider for the following ASP.NET features:
When you install ASP.NET, the Machine.config file for your server includes configuration elements that specify SQL Server providers for each of the ASP.NET features that rely on a provider. These providers are configured, by default, to connect to a local user instance of SQL Server Express 2005. If you change the default connection string used by the providers, then before you can use any of the ASP.NET features configured in the machine configuration, you must install the SQL Server database and the database elements for your chosen feature using Aspnet_regsql.exe. If the database that you specify with Aspnet_regsql.exe does not already exist (aspnetdb will be the default database if one is not specified on the command line), then the current user must have rights to create databases in SQL Server as well as to create schema elements within a database.
Each SQL Server provider can use the same SQL Server database to store the data for that particular feature. Each feature can be used individually, or in conjunction with other features. For example, you could use role management by itself or in conjunction with the user information managed by membership.
For more information about SQL Server providers and ASP.NET, see Implementing a Membership Provider, Implementing a Profile Provider, and Implementing a Role Provider.
SQL Cache Dependency
An advanced feature of ASP.NET output caching is SQL cache dependency. SQL cache dependency supports two different modes of operation: one that uses an ASP.NET implementation of table polling and a second mode that uses the query notification features of SQL Server 2005. Aspnet_regsql.exe can be used to configure the table-polling mode of operation. SQL cache dependency enables you to cache pages that are dependent on data from SQL Server tables. You can configure SQL Server and ASP.NET to cache page requests, reducing server workload, until the data on which the page depends has been updated in SQL Server. SQL cache dependency is useful for data such as product catalogs or customer registration information that remains comparatively static. Note that you must configure SQL Server to provide proper notification to ASP.NET about changes in dependent data when you use the ASP.NET table-polling mode of SQL cache dependency. Thus, you will need administrative privileges to configure the server. For more information about SQL cache dependency, see Walkthrough: Using ASP.NET Output Caching with SQL Server.
Session State
ASP.NET session state is designed to enable you to easily store user session data in different sources for your ASP.NET applications. By default, session state values and information are stored in memory within the ASP.NET process. Alternatively, you can store session data in a SQL Server database, where it can be shared by multiple Web servers. For more information about session state, see Implementing a Session-State Store Provider and Session-State Modes.
If the database that you specify for session state with Aspnet_regsql.exe does not already exist, then the current user must have rights to create databases in SQL Server as well as to create schema elements within a database. If the database does exist, then the current user must have rights to create schema elements in the existing database.
To install the session state database on SQL Server, run Aspnet_regsql.exe tool supply the following information with the command:
-
The name of the SQL Server instance, using the -S option.
-
The logon credentials for an account that has permission to create a database on a computer running SQL Server. Use the -E option to use the currently logged-on user, or use the -U option to specify a user ID along with the -P option to specify a password.
-
The -ssadd command-line option to add the session state database.
By default, you cannot use Aspnet_regsql.exe to install the session state database on a computer running SQL Server 2005 Express Edition. For more information about using SQL Server 2005 Express Edition to store session state, see Session-State Modes.