View Single Post
  #7 (permalink)  
Old December 31st, 2007, 01:39 AM
Bob Bedell Bob Bedell is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

I guess it would be more accurate to say that the GenericPrinciple is created at startup, it just isn't replaced with a null reference.

Here's the values of the two expression immediately after

System.Threading.Thread.CurrentPrincipal = (System.Security.Principal.IPrincipal)Session["CSLA-Principal"];

executes (from the Immediate Window):

?(System.Security.Principal.IPrincipal)Session["CSLA-Principal"];
null

?System.Threading.Thread.CurrentPrincipal
{System.Security.Principal.GenericPrincipal}
    [System.Security.Principal.GenericPrincipal]: {System.Security.Principal.GenericPrincipal}
    Identity: {System.Security.Principal.GenericIdentity}

The assignment just doesn't have any affect on the original value of CurrentPrincipal.