Discussion:
C# SQL connection string (Windows authentication)???
(too old to reply)
Maziar Aflatoun
2005-04-30 03:15:23 UTC
Permalink
Hi guys,

I'm using Windows authentication to connect to SQL Server 2000. On my
computer the connection is fine. Now if I move it to a remote server, how
to I hard code my Username/Password in my connection string (using Windows
NT authentication and not SQL Server authentication)?

Thank you
Maz.
Joshua Flanagan
2005-04-30 05:58:56 UTC
Permalink
You don't.

The main benefit of using Windows authentication for your connection to
SQL Server is that you can avoid coding a username and password into the
connection string.

To indicate you want to use Windows authentication in your connection
string, replace the "user id=xx;password=xx" part with
"Integrated Security=SSPI;"

The connection will be made using whatever account the process is
running under.
If it is an interactive desktop application (WinForms or Console), it
will run under the user's account.
If it is an ASP.NET website, without impersonation enabled, the
connection will be made from the ASPNET (on 2K) or NETWORK SERVICE (on
2K3). With impersonation enabled, and Anonymous access disabled in IIS,
it will run under the client user's account. If Anonymous access is
enabled, it will run under the IUSR_machinename account.

If you do not want to grant all users access to the SQL Server, you can
run your assembly under a specific identity in COM+.


Joshua Flanagan
http://flimflan.com/blog
Post by Maziar Aflatoun
Hi guys,
I'm using Windows authentication to connect to SQL Server 2000. On my
computer the connection is fine. Now if I move it to a remote server, how
to I hard code my Username/Password in my connection string (using Windows
NT authentication and not SQL Server authentication)?
Thank you
Maz.
v***@gmail.com
2016-02-26 07:39:33 UTC
Permalink
Hi,

After appending the connectring with Integrated Security=SSPI, my Nettalk application connects to the mssql db in exe mode but fails when running as a service.

Thanks,
Vic

Loading...