How to create a trusted Connection in .NET application to MS SQL Database
Trusted Connection can be set in the Connection String in different Ways
1) Integrated Security= True
2) Integrated Security=SSPI; ( same as True)
3) Trusted_Connection=True;
Integrated Security= True uses the Windows Credentials for Authentication,
If user Id, password are presented in the Conenction string this setting will ignore them.
How ever If Integrated Security=SSPI, uses the Windows credentials for Authentication if userid and pwd are not present, if User ID and Password are passed in connection string they will be used over windows credentials.
So Microsoft prefers using SSPI.
On the web application it's the identity that is set for the application pool in IIS. For the console application it's the user id that has ran the console applicaiton (not sure who or how you're kicking that off).
Then on the database side the DBA needs to add the Active Directory user account that you are using for both the web and console application to the database and grant the appropriate privileges.
1) Integrated Security= True
2) Integrated Security=SSPI; ( same as True)
3) Trusted_Connection=True;
Integrated Security= True uses the Windows Credentials for Authentication,
If user Id, password are presented in the Conenction string this setting will ignore them.
How ever If Integrated Security=SSPI, uses the Windows credentials for Authentication if userid and pwd are not present, if User ID and Password are passed in connection string they will be used over windows credentials.
So Microsoft prefers using SSPI.
On the web application it's the identity that is set for the application pool in IIS. For the console application it's the user id that has ran the console applicaiton (not sure who or how you're kicking that off).
Then on the database side the DBA needs to add the Active Directory user account that you are using for both the web and console application to the database and grant the appropriate privileges.
No comments:
Post a Comment