Impersonate user with trusted connection to SQL Server

From: Burkhard Vogt (b.vogt@esteps.de)
Date: 09/18/02


From: "Burkhard Vogt" <b.vogt@esteps.de>
Date: Wed, 18 Sep 2002 08:49:07 -0700


Hi!

I'm trying to change the user accunt on a WinForms
application.

I use Win32-Api LogonUser to create a new WindosIdentity-
Object 'newuser'.
Then I call newuser.Impersonate() to change the users
identity in the AppDomain.
This all works fine and WindowsIdentity.GetCurrent()
returns the new user.
The problem is, if I try to establish a connection to SQL
Server with 'truested_connection=yes' in the connect
string the application trys to logon with NT-
AUTHORITY/ANONYMUS (no user).

Any idea?