• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 619
  • Last Modified:

Impersonation Problem on Windows XP

I have a program that uses impersonation. On one clients pc, it doesn't work. The operating system is Windows XP, SP2.
I thought the issue was with report viewer, but it seems more to do with impersonation.
I ran some test programs, and this is what happens:
1) Reports without impersonation work fine

2) Programs with impersonation generate temp dll files, and then reports won't launch as I get a message about
'C:\Documents and Settings\theusername\Local Settings\Temp\expression_host_abc12324334435435435.dll in use by another process'

3) And now the freaky one. I wrote a simple program that just prints the contents of a folder to a report. Added a tick box, so that Impersonation can be turned on/off. With Impersonation off, everything ok. Turn impersonation off, and I get the '....dll in use by another process' message above.
However, once that message is generated, the program will never run again! Even if I reboot the pc. Or remove and re install the program. Once impersontation has been used, it won't run again, even if don't use impersonation again.

This one is really baffling me. I know that on Win 2000 pcs, local security settings had to be changed to get impersonation to work. But I haven't read anything similiar for Windows XP.
Any help appreciated!

  • 3
  • 2
1 Solution
Kevin HaysIT AnalystCommented:
Are you using the WindowsIdentity.Impersonate method in the .net or something else?

I know you must stop the impersonation of the user.  If i'm not mistaking weird things can happen if you don't.

Is it just this one pc that is not working?  Also are the other pc's windows xp also and do they work fine on those?
jdhackettAuthor Commented:
My code is at

Just one pc, works fine on the other pcs, most of which are xp.
I do stop the impersonation after I fill my datasets. As you say, otherwise flaky things happen.
What I really don't get is how using impersonation once stops that program from ever working again.
Kevin HaysIT AnalystCommented:
Since it's working fine on other pc's then I would almost bet you could rule out it being your code.  It doesn't really make sense that once you impersonate and release it that the program stops working even after you reboot.

I would probably try and compare the settings of the working pc to this one you are having trouble with.  gpedit.msc or local security policy for starters, all updates to windows and the .net framework as well.

I've fiddled with impersonation some, but i've never had the problem you are experiencing right now though.
jdhackettAuthor Commented:
I've checked that all the windows updates are installed. As far as I know, windows updater pulls down all the latest dotnet updates anyway.
I've also checked the security policy, looks the same as the others. Not sure what else I can do.
jdhackettAuthor Commented:
I still don't have a solution to this issue. However, I do appreciate kshays suggestions, the gpedit.msc was new to me, and very useful. In fact, it helped me solve a different issue. In this case, it has at least ruled out what the problem this could be.
To reflect this, I've now given kshays a C grade. I'll update here if I ever find a solution.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now