I have custom identity and principal objects (LVIdentity and LVPrincipal) that are identical to PTIdentity and PTPrincipal except that I have added an ID property to LVIdentity. Upon login, I set the Csla.ApplicationContext.User to my custom principal in the following way:
LVIdentity identity = LVIdentity.GetIdentity(username, password);
LVPrincipal principal = new LVPrincipal(identity);
Csla.ApplicationContext.User = principal;
I have read in other posts that in order to access the ID property of the Csla.ApplicationContext.User.Identity object, I must cast it as my custom LVIdentity:
LVIdentity identity = (LVIdentity)Csla.ApplicationContext.User.Identity;
int m_id = identity.ID;
As confirmation of this, I am unable to see the ID property in Intellisense until I cast in the above manner.
The problem I am having is that when I attempt to use the above code, I get the following error:
"DataPortal.Fetch failed: unable to cast object of type 'System.Security.Principal.GenericIdentity' to type 'LV.Security.LVIdentity'".
What am I missing?
Rocky,
You're the best! That was it. Thanks :)
Copyright (c) Marimer LLC