Reputation: 12384
I have an ASP.Net app, that runs using windows authentication. The connection to the SQL Server is usually done by creating a sql server account and using that in the connection string.
However, in this specific very restrictive hosting environment, we have been asked to use a specific WINDOWS/active directory account to connect to the SQL Server.
Please note it is not the windows credentials of the user of the website, we need to connect to the SQL server with - it is one specific windows/AD account.
How do I configure that in my connection-string?
Upvotes: 8
Views: 30096
Reputation: 19
Use the Runas option to start the program with the specific Window User. The program will connect to the sql server with this user.
Upvotes: 1
Reputation: 755287
If you want to achieve this, you need to:
Your connection string would be something like:
Server=dbServer;database=theData;User ID=loginname;password=Top$ecret
If you tell SQL Server to use integrated security, it will always use the currently logged on user as the one who connects to the server - you cannot change that.
Upvotes: 0
Reputation: 121037
Use a connectionstring like this:
Server=YourServer; Database=YourDatabase; Integrated Security=true;
Your program has to run under the account that you need to connect as. You can set the identity of your website in IIS by editing the AppPool.
Upvotes: 14