View Single Post
  #6 (permalink)  
Old December 31st, 2007, 01:25 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

Geeez, after all that I finally read your code carefully enough to see you're actually concerned about:

// This will crash, right?
// Session["CSLA-Principal"] IS null....
System.Threading.Thread.CurrentPrincipal = (System.Security.Principal.IPrincipal)Session["CSLA-Principal"];

For some reason I just started writing about your first "//Not null"
notation. My apologies for the session variables 101 lecture.

When Session["CSLA-Principal"] is null, and is assigned to CurrentPrincipal, .NET automatically instantiates a GenericPrinciple, which CurrentPrinciple then references. So no, it doesn't crash. The app just works with a GenericPrinciple until Session["CSLA-Principal"] references an authenticated custom BusinessPrincipal.

Best,

Bob