I have in my
web.config two connection strings like so:
<connectionStrings> <add name="myConnectionString" connectionString="Data Source=PC1; Initial Catalog=BD; Integrated Security=SSPI" providerName="System.Data.SqlClient"/> <add name="myConnectionString2" connectionString="Data Source=PC2; Initial Catalog=BD2; Integrated Security=False; User Id=usuario; Password=pass" providerName="System.Data.SqlClient"/> </connectionStrings>
First connection string:¨
I can connect with the first connection, which is a database on my localhost with my user using windows authentication.
Second connection string:¨
The second connection is to a database on another server that I run as another Windows user . In the second case,
Integrated Security = False . I send the key as "clean" text, without encryption.
When I run it on SQL Server as another user, I enter the credentials and I do have access.
How should the connection string be passed so that it accepts the other user's credentials?
I think you only have 2 options:
1.- Add the user that executes your application (user of the application group of the website in IIS) in the session permissions of the second DB.
2.- Change the user that runs your application to the user with session permission in the DB.
I hope that helps you.