Trusted Connection - SQL Server

liunx

Guest
Is it possible in .Net to log into sql server using the windows login instead of using the rights of ASPNet account? In VB I usually set it to trusted connection and it automatically uses the user's account.

Thanks
Shannontry this in your connection
ConnectString = "initial Catalog=DataBase; Integrated Secutiry=SSPI"That is what I have now but the ASPNet account is used and not the user's windows account. At the moment the aspnet account must have access to all of the databases and I am trying to use the user's account.

Thanks
Shannonnot sure if this can help, but you may wanna give a try:

1) backup your current setting
2) add Impersonation to your web.config

i.e:

<configuration>
<system.web>
<!-- other settings omitted. -->
<identity impersonate="true" userName="(sql login name goes here)" password=" (sql pw goes here) >
</system.web>
</configuration>


noticed password for impersonated account cannot be encrypted in web.config, so there's a security risk (at the same time, IIS won't allow u can't access web.config through a browser)

give a shot and see how it goes :)
 
Back
Top