views:

53

answers:

0

I understand that impersonation is tied to a single thread. However, managed threads could be shuffled around on top of native Win32 threads, so should I try to bind the identity using Thread.BeginThreadAffinity()? And should I use Thread::ManagedThreadId when checking calls later on an object that manages the impersonation?

EDIT:

But then again, there is the problem of disposing of the impersonation manager object when induced by the GC (Finalize()), because then it won't be possible to call Thread.EndThreadAffinity() since it happens on the GC thread :(