Problem solve Get help with specific problems with your technologies, process and projects.

Configuring ASP.NET 2.0 apps to SQL Server 2005 databases

Improved security features in ASP.NET 2.0 and SQL Server 2005 makes configuring the two a little tricky. Here we point to two tutorials that explain the process quite well.

Without data access, ASP.NET applications are just pretty Web pages. Trouble is, connecting ASP.NET apps to a SQL Server database isn't exactly a walk in the park, particularly when working with the beefed-up security features in ASP.NET 2.0 and SQL Server 2005.

The topic of configuring ASP.NET 2.0 applications to work with SQL Server 2005 first came up, naturally, in the weeks before both products were released to the world. Since different enterprises migrate to new technologies at different speeds, though, we thought it wise to revisit this topic by pointing to a couple very thorough tutorials.

The first tutorial, Configuring an ASP.NET 2.0 Application to Work with Microsoft SQL Server 2000 or SQL Server 2005 by Imar Spaanjaars, begins with a quick look at the two types of authentication that can be used to access a SQL Server database. From there, the author offers quick hints for attaching the appropriate databases to SQL Server.

The bulk of Spaanjaars's piece, though, centers on the three main scenarios for configuring the database and application:

  • SQL Server authentication -- " From a configuration point of view, this is probably the easiest scenario to configure: all you need to do is create a user in SQL Server, assign a password and then use that account in the connection string."
  • Windows Authentication with IIS and the database on the same machine -- " This scenario makes it easy to use Integrated Security because both the web server and SQL Server can use the same Windows account."
  • Using Windows Authentication with IIS and the database on different machines -- " When using this scenario, there are two options that you need to be aware of: both machines fall under the same Windows domain, or both machines can be seen as independent, stand alone machines."

The second tutorial, Configuring ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005, comes from Scott Guthrie. ASP.NET 2.0 comes with several application services, which are APIs governing membership, roles, personalization and other "super common scenarios with Web applications today," Guthrie notes.

Out of the box, these application services are configured to use the free SQL Express database, so Guthrie provides a quick walkthrough of the process of connecting the services to a regular old SQL Server database. Fortunately, there is a wizard to lead developers along.

Once the application is configured to its database, development can begin in earnest. Questions will undoubtedly emerge along the way, and in that regard, one should visit the ASP.NET 2.0 Learning Guide or the SQL Server 2005 Learning Guide for assistance.

Dig Deeper on ASP.NET development best practices

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.