[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Impersonation COM interop in a thread

Dave Brotherstone

6/2/2007 3:48:00 PM

Hi,
I have an object that performs some operations on an MS Access
database using COM (DAO and ADO libraries). I'm actually creating a
linked table to a SQL Server table, using integrated security. It
does this under impersonation (LogonUser then
WindowsIdentity.Impersonate()). This works fine if run all in the
main application thread. However, if I start a new thread off, then
LogonUser and Impersonate the call fails (Logon failed for the user
that the process is actually running as, not the impersonated user).
I've tried impersonating before I start the thread, and impersonating
again in the thread, but the same result.

I'm not doing anything with the COM object prior to impersonation. I
suspect this is something to do with the thread the COM object is
running on is the primary application thread, but I could be way off
there!

If anyone knows if this is possible, any pointers would be much
appreciated - I haven't been able to locate much in the way of how COM
interop and impersonation work together.

Many thanks,

Dave.