//show who we are running as - should be customuser
System.Security.Principal.WindowsIdentity ident = System.Security.Principal.WindowsIdentity.GetCurrent(); Debug.WriteLine("Page_Load: " + ident.Name); //retrieve the security token , and cache it in a static variable so it can be used by the other thread. _intsecuritytoken = System.Security.Principal.WindowsIdentity.GetCurrent().Token; //create the batch request object and submit a request
AsyncThreadRequest request = new AsyncThreadRequest(); request.Add(new SendReportRequestDelegate(this.FuncToRun)); request.SubmitRequest(true, 20);
//show who we are running as (should be ASPNet)%
System.Security.Principal.WindowsIdentity ident = System.Security.Principal.WindowsIdentity.GetCurrent(); Debug.WriteLine("FuncToRun() - Before Impersonation: " + ident.Name);
//create a new windows identity, with the cached security token from customuser System.Security.Principal.WindowsIdentity windid = new System.Security.Principal.WindowsIdentity(_intsecuritytoken); windid.Impersonate();
ident = System.Security.Principal.WindowsIdentity.GetCurrent(); Debug.WriteLine("FuncToRun() - Before Impersonation: " + ident.Name);
Posted in Code |Comments [0]
Sysknowlogy