Threading & Security Context question

  • Thread starter Thread starter Jerry Negrelli
  • Start date Start date
J

Jerry Negrelli

I'm running an ASP.NET application which uses
impersonation & Windows authentication to set the current
Principal. One of my methods was taking an awful long
time to run, so I decided to launch it in a new thread
using the following two lines of code:

Thread bob = new Thread(new ThreadStart(MyMethodName));
bob.Start();

When MyMethodName is executed, it attempts to make a
remote registry call & causes a SecurityException with
the message "Access Denied". Is "bob" running under the
same context as my original code? If not, how can I
force this new thread to share these permissions?

A shiny new donkey to whoever can help me solve this
problem!

JER
 
Update:

I was able to solve this by capturing the current
Identity token and storing it in a place that both the
primary thread and the new thread could both access.
Then I called
System.Security.Principal.WindowsIdentity.Impersonate and
passed it this shared token.

JER
 
Back
Top