you need to pass the creditials of the current thread to the new created
thread.
class foo()
{
private WindowsIdentity mThreadIdentity = null;
[DllImport("adva pi32")] static extern bool RevertToSelf();
public void StartThread()
{
// setup thread
ThreadStart ts = new ThreadStart(Run Report);
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
}
}
"Patrick" <pa**@reply.new sgroup.msn.com> wrote in message
news:B3******** *************** ***********@mic rosoft.com...
I have an ASP.NET web service whose Web.Config is set to use impersonation
<authenticati on mode="Windows" />
<identity impersonate="tr ue" />
Within a Web Method, I want to use Multi-threading to spawn off an
asynchronous process, as it takes quite long to return. How could I get
the
worker thread to runas the same impersonated user on ASP.NET?
Dim worker As System.Threadin g.Thread = New
System.Threadin g.Thread(Addres sOf reportManager.R unReport)
worker.Start()