1

In my current ASP.Net site, I am already using impersonation to run all of the requests under:

<authentication mode="Windows">
</authentication>
<identity impersonate="true" />

Then, I want to grab the status of a service. this creates a double hop, so I impersonate a specific user. I am then able to query the service on the remote machine.

I then want to undo the specific impersonation and revert back to the users original impersonation.

When I try the examples linked below, it always reverts back to the ASP.Net user.

How do you do Impersonation in .NET? Help Understanding Impersonation

My page/controller needs to follow the following example:

1) Request made as BoFlexson --Auto impersonates as BoFlexson

2) Impersonate ServiceUser: Ask for Service Status

3) Revert Back to BoFlexson: Do some other task.

4) Impersonate ServiceUser: Ask for Service Status Again

5) Revert Back to BoFlexson: Do some other task.

Again, when I try to Undo the impersonation context, it goes all the way back to the ASP.Net user, as if I didn't have the <identity impersonate="true" /> setting at all.

Any help with this would be greatly appreciated.

Community
  • 1
  • 1
Bo Flexson
  • 481
  • 1
  • 6
  • 9
  • Have you considered re-impersonating BoFlexson when you disable impersonation for ServiceUser? – Zachary Jan 31 '11 at 19:48
  • I have tried saving off the CurrentUser, then doing impersonate again, but this seems to fail: CurentUser = WindowsIdentity.GetCurrent() ..... CurrentUser.Impersonate() – Bo Flexson Jan 31 '11 at 19:49

0 Answers0