How do I use integrated security for SQL Server connection on my web site?

Determine the User your site is running under:

IIS6:

Start by logging into your server and opening up the IIS Management Console.

Next locate the site you would like to use integrated authentication on and right click and select properties.

Next select the security tab and click on the Edit button.

This should display the user that the web site is running as.

IIS7:

Now that you know what user the site runs under you can grant this user permissions on the database server. Open up SQL Management Studio and expand the Security folder.

Right click on the Logins folder and select New Login.

Click on the search button to the right to begin locating the Windows Login for your site.

Now click on the Advanced button and then the Find Now button. This should list all the users and groups on the system.

Now select the user from the list that was listed under the security tab in IIS.

One you have this users selected press ok to return to the new user options.

Now set the default database for your site at the bottom.

Now select the User Mapping Tab from the top left hand corner. Once the list of databases appears, check the box next to your database name and then the db_owner checkbox as well. Public should already be checked by default.

Now press Ok and your IIS user should have access to your database and you should be able to use integrated authentication.

Article ID: 201, Created On: 1/11/2010, Modified: 5/11/2011