Search code examples
sql-server-2008asp-classiclocalhostwindows-authentication

Connect to SQL Server database from classic ASP using windows authentication


I am normally a .NET developer so have no experience with classic ASP.

I have been asked by a client to have a look at their classic ASP site. I am trying to recreate their site on my local machine so can have a play with but am having difficulty connecting to my copy of the database. The database has been recreated on SQL Server 2008 using windows authentication and I'm having difficulty with the connection string.

This is what I have so far:

Provider=SQLOLEDB;Data Source=MY-PC\SQLExpress;Initial Catalog=testdb;Integrated Security=SSPI;Persist Security Info=False;

Keeps saying

login failed.

Any ideas?


Solution

  • Modify the anonymous user account details that your local site uses to your own logon account.

    The problem is that ASP scripts always run using impersonation either of the user associated with an authenticated connection or as the anonymous user account. The anonymous user is normally the rescricted IUSR account.

    You could just turn off anonymous access and turn on Windows Integrated but I find its best for local development purposes to just change the anonymous user.