To obtain Web Service security context

O

Oleg Boldyrev

Hello all!

I'd like to to impersonate the domain account a web service runs under. I
need this to do a trusted connection to SQL Server.
The current settings for the ASP.NET app are windows authentication and
impersonation. So if I do a trusted connection to SQL Server it would be
in the context of the current user which I don't want.
I like the approach with no global impersonation setting and manual
impersonation when nessessary, like was advised here, but that I can't
change the current global settings because the project is not mine and far
under way, I'm afraid to break something :-\
I feel I would be happy if I could obtain the WindowsImpersonationContext
for the account which runs the working process. If sombody could tell me how
to do this. In fact, all I want to do is to change the current security
context to that of the worker process, execute a sql query and then revert
to the previous context.
I don't want to explicitly set the credentials of any account. Is it
possible?
 
J

Joe Kaplan \(MVP - ADSI\)

Did you see the sample that Brock posted here that shows the trick of
impersonating the null token (which results essentially in "revert to self")
and then undoing the impersonation context to start the impersonation back
up? This sounds like what you need.

Joe K.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top