B.2. Configuring Application Services

Earlier in this book you learned that the ASP.NET application services make use of a SQL Server 2005 database that is reached by using a connection string called LocalSqlServer. The application services then ensure that a new database called aspnetdb.mdf is created in your web site's App_Data folder the very first time you use one of the application services like Membership or Profile.

What if you don't want to use the default aspnetdb.mdf database but rather one of your own? Or what if you rather not rely on a local SQL Server Express database to be created for you, and instead want to get your membership, role, and profile data from your own, dedicated server?

In such cases, you need to reconfigure your application (through the web.config file) and tell it where your database is located. There are two ways to accomplish this: overriding the LocalSqlServer connection string, and overriding the settings for the various application services. However, before you look at these two options, you need to know how you can prepare a custom database for the ASP.NET application servicess.

B.2.1. Configuring Your Database for the Application Services

When the aspnetdb database is created for you in the App_Data folder, it already contains a number of objects like tables and stored procedures (snippets of SQL code that can be executed at the server). If you want to use your own database instead of the default one, you need to prepare your database for ...

Get Beginning ASP.NET 3.5: In C# and VB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.