A
amy g
I have an ASP.NET application using impersonation, and ran into the issue where if I start a new thread, that thread runs as the ASP.NET user instead of the impersonated user
I found this post, http://groups.google.com/[email protected], which discusses how to handle this using an asynchronous method call by passing System.Security.Principal.WindowsIdentity.GetCurrent() into the asynchronous method and then calling Impersonate on the passed identity
In that post, the author says they wouldn't know how to do this if they were creating their own thread, but doesn't explain why
The code I have (inherited) does create its own thread, using new Thread, new ThreadStart, etc. I tried using the info in "Passing Data to Threads" here, http://msdn.microsoft.com/library/d...y/en-us/cpguide/html/cpconcreatingthreads.asp, to pass the WindowsIdentity to the new thread and call Impersonate on it, and it seems to work
But I'm not terribly familiar with either impersonation or threading, so I wanted to check if someone could verify that I'm not missing anything, and this should work?
I found this post, http://groups.google.com/[email protected], which discusses how to handle this using an asynchronous method call by passing System.Security.Principal.WindowsIdentity.GetCurrent() into the asynchronous method and then calling Impersonate on the passed identity
In that post, the author says they wouldn't know how to do this if they were creating their own thread, but doesn't explain why
The code I have (inherited) does create its own thread, using new Thread, new ThreadStart, etc. I tried using the info in "Passing Data to Threads" here, http://msdn.microsoft.com/library/d...y/en-us/cpguide/html/cpconcreatingthreads.asp, to pass the WindowsIdentity to the new thread and call Impersonate on it, and it seems to work
But I'm not terribly familiar with either impersonation or threading, so I wanted to check if someone could verify that I'm not missing anything, and this should work?