Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
Running spawned worker thread as impersonated user
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Bruce Barker, post: 515914"] you need to pass the creditials of the current thread to the new created thread. class foo() { private WindowsIdentity mThreadIdentity = null; [DllImport("advapi32")] static extern bool RevertToSelf(); public void StartThread() { // setup thread ThreadStart ts = new ThreadStart(RunReport); Thread t = new Thread(ts); mThreadIdentity = WindowsIdentity.GetCurrent(); // drop any impersonation RevertToSelf(); // start thread t.Start(); // restore thread identity mThreadIdentity.Impersonate(); } private void RunReport() { mThreadIdentity.Impersonate(); // do whatever } } [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
Running spawned worker thread as impersonated user
Top