blah blah blah is here! blah blah » Close

up0down
link

Before I smash my head through the wall, I thought I'd make a plea for help with a threading issue that I've had for most of the day.
Has anyone trying to create a multi-threaded ASP.NET application? Not a multi-threaded Windows Service or Windows Application but an ASP.NET web application?
My primary thread uses Windows impersonation thanks to that handy web.config file. Any new threads that I create, however, do not keep this security context and instead run as "MYMACHINE\ASPNET".
If I check System.Threading.Thread.CurrentPrincipal from a new thread, it says that the current thread Principal's Identity is "MYDOMAIN\ME" -- this variable is either incorrect or not what I thought it was, though, because if I check System.Security.Principal.WindowsIdentity.GetCurrent().Name from the new thread it equals "MYMACHINE\ASPNET".
I've been looking around the net for a few hours now and haven't been able to find the "AHA!!!" article that I've been looking for that will help me resolve this.

last answered 2 years ago

1 answers

up0down
link

Well, some things never change. Just after I posted this, I think I figured it out.
You can get the current Identity prior to starting a new Thread, set it to an object that is viewable from the other thread, like a local class variable or a Session object, then use the Impersonate method to grab that principal and set it to the current principal...

This post was imported from csharpfriends, if you have a similiar question please ask it again.

All previous members have been migrated, hope you enjoy the new platform!

Feedback