Advertisement

05.03.2004 at 10:42AM PDT, ID: 20976259
[x]
Attachment Details

ASP connection to SQL using Windows Authentication

Asked by dgooding in Miscellaneous Web Development

Tags: authentication, sql, windows

I've been struggling with this for a while now.  One of the troubles is, I'm not admin on any of the servers (IIS, SQL, or AD).

I'm writing a web/db app that needs to use windows authentication to connect to a sql server.  The domain controller, web server, and sql server are three different machines.  Currently, I have NT permissions set to prompt a user for a login/pass (NTLM, not basic).  I would like to use those credentials to attach to the sql server.  I've had no luck.  

SQL server is set to Mixed Mode.  IIS server is set to NTLM login.  

I've used various connection strings in ASP, but again, no luck.  I can connect to the DB using Enterprise Manager authenticating with my domain login (so, I'm a valid db user).

Some connection strings I've used:

1.
conn.open "Provider=SQLOLEDB.1;UID=mydomain/myusername;Password=mypassword;Persist Security Info=True;Initial Catalog="&tablename&";Data Source="&servername
((here, i've hardcoded in my login/pass (which I don't want to do) and error: "Login failed for user mydomain/myusername"))

2.
conn.open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog="&tablename&";Data Source="&servername
((here, i've used "integrated security" but error: "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'"))


I've used plenty of other combinations of switches and options but to no avail.  However, I created a "Standard" sql login and used it's username/password to connect (via #1, above) it worked just fine.  

Bottom line.  I am using NTLM to authenticate to my web app.  I can connect to my DB using a sql account.  I want to connect to my DB using NTLM authentication.  The three services (IIS, SQL, AD) are on three different servers.  Any help?
Start Free Trial
[+][-]05.03.2004 at 12:05PM PDT, ID: 10980588

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.03.2004 at 12:21PM PDT, ID: 10980744

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Miscellaneous Web Development
Tags: authentication, sql, windows
Sign Up Now!
Solution Provided By: modulo
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.03.2004 at 12:22PM PDT, ID: 10980751

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]05.03.2004 at 12:26PM PDT, ID: 10980800

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32