ASP.NET Providers - Getting Started
This blog post is part of a series about the ASP.NET Providers (namely Membership, Role Management, and Profile). The introductory post in the series can be found at the following link, which introduces the Provider Model pattern and gives a personal example of an implementation I have been working on:
This post will deal with getting started using the ASP.NET Providers by setting up a database.
Database Setup
First, you will need to configure a database to securely store all of the site’s user data and activity info. You’ll most likely be content with the already provided SQL Providers (such as the SqlMembershipProvider), but Microsoft also provides you with other options in many cases. For example in the case of Membership, you also have the option of having your site use the ActiveDirectoryMembershipProvider or you can even roll your own MembershipProvider. The nice thing about using any of these Microsoft Providers is that they are already set up to store sensitive data like passwords in an encrypted format in the database.
There are two tools you can use to automatically generate the necessary database tables needed for the SQL implementation. The first tool is a web-based configuration tool launched from Visual Studio called the ASP.NET Website Administration Tool. It can not only create the database tables, but can also configure authorization rules, user roles, user accounts, and many other settings that go right into your Web.config. It is launched by selecting the ASP.NET Configuration menu option in the Project menu (or Website menu, depending on which version of Visual Studio you have or the project template you selected). However, this tool will create the database in a SQL Server file named ASPNETDB.mdf placed in the site’s App_Data folder. If you would prefer to create the database schema in an already existing install of SQL Server (likely on a different box), you need to use the aspnet_regsql.exe command-line tool. The command-line tool’s graphical interface can be launched by typing the name of the executable in a Visual Studio Command Prompt (located in the Start Menu under Visual Studio | Visual Studio Tools).
The only other thing you need now is the connection string to this newly populated database. I will show you where in your Web.config to put the connection string in the next post of this series.
Read On!
Continue onward by reading the next blog post in this series found at the following link:
tag and the “credentials” tag to then add a user to my web.config you should consider adding this approach as well.