Installing ASP.NET Membership, Roles and Profiles support in SQL Server
Here are few quick tips if you’re using the ASP.NET Application Services with SQL Server, like Membership, Roles, Profiles, Personalization or Web Events. These built-in “building-block” services have SQL provider implementations in .NET that let you use a SQL Server 2000 or 2005 database as their data store. These are the framework classes that implement the SQL Server providers:
- SqlMembershipProvider – managing user credentials and authentication
- SqlRoleProvider – handling role-based authorisation
- SqlProfileProvider – storing and retrieving information about individual users
- SqlPersonalizationProvider – saving state of web parts
- SqlWebEventProvider – capturing and logging web event data
ASP.NET SQL Server Registration Tool
Adding support for these providers to your database is easy, just run the ASP.NET SQL Server Registration tool from the command-line (aspnet_regsql.exe) to launch the ASP.NET SQL Server Setup Wizard. This will guide you through the process with a simple GUI:
cd C:\Windows\Microsoft.NET\Framework\v2.0.50727 aspnet_regsql.exe
By default, the wizard installs all five services : Membership, Roles, Profiles, Personalization and Web Events. However, if you need support for only some, say just Membership and Roles, then aspnet_regsql can be run from the command-line with specific options, for example:
aspnet_regsql -S MySqlServer -E -A mr -d MyAspDatabase
This installs the Membership and Roles services (-A mr) on server MySqlServer in database MyAspDatabase using current Windows credentials for authentication. To see a full list of command-line options and switches, run the registration tool with the help flag:
aspnet_regsql.exe /?
There’s also an option to generate just SQL scripts without executing them, and another to remove services from the database that aren’t used or needed anymore. (You can also manage SQL cache dependencies and session state using this tool.)
For more info about ASP.NET SQL providers: