Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Thread.CurrentPrincipal
Message
De
30/09/2009 10:14:20
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Securité
Titre:
Thread.CurrentPrincipal
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01426870
Message ID:
01426870
Vues:
129
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform