P
Phil Johnson
Hi,
I have a WPF app written in C# 3.5
I have created a custom principal and attach it to the thread in my main
window with the following code...
CustomPrincipal principal = new CustomPrincipal(new
CustomUser(), new string[0]);
Thread.CurrentPrincipal = principal;
Now, I have the following line in another WPF window to get the custom
principal from the thread to check the user, but I get an error saying I
cannot cast a generic principal to my custom principal (note, if I put this
line straight after the code to set the principal above then it casts the
principal without any problems)
CustomUser user =
(CustomUser)((CustomPrincipal)Thread.CurrentPrincipal).Identity;
--
Regards,
Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com
I have a WPF app written in C# 3.5
I have created a custom principal and attach it to the thread in my main
window with the following code...
CustomPrincipal principal = new CustomPrincipal(new
CustomUser(), new string[0]);
Thread.CurrentPrincipal = principal;
Now, I have the following line in another WPF window to get the custom
principal from the thread to check the user, but I get an error saying I
cannot cast a generic principal to my custom principal (note, if I put this
line straight after the code to set the principal above then it casts the
principal without any problems)
CustomUser user =
(CustomUser)((CustomPrincipal)Thread.CurrentPrincipal).Identity;
--
Regards,
Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com