Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows authenticatiion connection string

Status
Not open for further replies.

adonet

MIS
May 4, 2004
312
US
I have a windows app and connected to a windows authentication SQL server-OrderSQL and works fine.
Here is connection string:

"data source=OrderSQL;initial catalog=Order;integrated security=SSPI;persist security info=False;Enlist=True;Pooling=False;Connection Lifetime=30"

I used this string in ASP.NET web.config file but got error.

Can someone help me?
 
By default your ASP.NET application runs under the MACHINENAME\ASPNET account. If you are using Widnows Authentication with SQL this account must have the correct priveleges in SQL server or it will not be able to login. Alternatively you can choose to make your app impersonate another windows user by adding the following element to your web.config file
Code:
<identity impersonate="true" username="domain\username" password="password" />
HTH

Rob

Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Eisenhower 1953
 
Thank you. I just copy the code or need change it? For example, different user has different username and password.
 
Yeah you'd need to replace it with the appropriate DOMAIN, USERNAME and PASSWORD for your environment. The way we implement this exact scenario is to create a domain user account for the application e.g. DOMAINNAME\APPLICATIONNAME and then add this as a login for SQL Server with correct privileges to access the required databases. We then make the application impersonate that account. This way we can apply SQL permissions, File system permissions, service permissions etc for the application as a normal windows user.

Rob

Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Eisenhower 1953
 
There are about 500 users in out company. How to do it?
 
Oh I see! :) You want to apply the SQL permissions by the user yes? In that case just use
Code:
<identity impersonate="true" />
And providing you have Windows Authentication on and Anonymous Access off for the website in IIS then the application will impersonate the authenticated user for SQL permissions, File access etc etc Obviously this is IE only as Widnows Authentication only works in IE.

Rob

Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Eisenhower 1953
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top