Trusted Connection to SQL-Server by impersonate a user

  • Thread starter Thread starter =?iso-8859-1?Q?Jan_Weing=E4rtner?=
  • Start date Start date
?

=?iso-8859-1?Q?Jan_Weing=E4rtner?=

Hi.

I use the example for "WindowsIdentity.Impersonate" to impersonate a user.
This works fine, but if i try to connect to the SQL-Server via trusted
connection (Security=SSPI) the connection is using the _actual_ but not
the impersonated user.
How can i connect to the SQL-Server via SSPI as another user?

thanks,
Jan
 
Hi Jan,

That should be enough. Are you calling Impersonate() before
connection.Open() or after that (e.g. before execute)? How do you obtain the
token handle for the user you're impersonating? What version of Windows are
you using?

--
Pablo Castro
Program Manager - ADO.NET Team
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.
 
That should be enough. Are you calling Impersonate() before

Of course not!

Thanks,
Jan
 
Hi.

Does SQL server login with impersonation also work via VPN?
Assuming i establish a VPN to a server in the internet. Can i
impersonate another user on this server and connect as this
other user to the SQL server?

thanks,
Jan
 
Back
Top