Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Thread.CurrentPrincipal
Message
From
30/09/2009 10:14:20
 
 
To
All
General information
Forum:
ASP.NET
Category:
Security
Title:
Thread.CurrentPrincipal
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01426870
Message ID:
01426870
Views:
130
Hi,
Trying stuff out. I have this code at startup:
GenericIdentity g = new GenericIdentity("Viv");
GenericPrincipal p = new GenericPrincipal(g,new string[]{"Admin","Backup"});
Thread.CurrentPrincipal = p;                                                  
// System.AppDomain.CurrentDomain.SetThreadPrincipal(p);  //Works
then later (in a different form)
System.Security.Principal.IPrincipal g = System.Threading.Thread.CurrentPrincipal;
but g.Identity at this point is an empty,unauthenticated instance (as it is before setting the Thread.CurrentPrincipal). If I use the CurrentDomain.SetThreadPrincipal version above instead then g.Identity is as expected. AFAICS this is still the same thread so why the difference?

TIA,
Viv
Next
Reply
Map
View

Click here to load this message in the networking platform