ADODB integrated authenticantion instead of username and password authenticantion

Hallo Expert,

I am relatively new in ASP and need to switch from username+password ADODB authentication to integrated authentication ADODB.

My database is MSSQL 2005

My username+password ADODB authentication looks like this. And it is included in all my ASP sites.
Can someone please tell me how to change the code so it works with authentication to integrated authentication ADODB?

And do I have to change other parts in my code as well or only this part?  

Thanks,

Steynsk


Set CS = Server.CreateObject("ADODB.Connection")
CS.Open "DSN=MyDNS;Uid=MyUsername;Pwd=MyPassword"
 
 
query = "SELECT * FROM tablename"
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open query, CS

Open in new window

LVL 1
SteynskAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
the connection string would be like this:

CS.Open "Provider=SqlOledb;Server=yoursqlsevername_or_ip;Integrated Security=SSPI;"

however, to use the end-user's windows account, only possible on intranet solutions (otherwise the asp startup account will be used...), you need to configure the iis web site to disable anonymeous access.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mironCommented:
You could grant windows account running IIS service access to SQL Server.
If SQL Server is located on remote machine you will need to configure IIS site service account to run under domain account. Here is one more example of connection string:
"Provider=SQLOLEDB;Integrated Security=SSPI;Initial Catalog=pubs;Data Source=."
0
SteynskAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.