Getting current user from .Net in Uno/UWP project #2745
-
In my UWP project under the Uno platform, I am trying to get current user data from .Net. In App.xaml.cs, OnLaunched, I execute: When I examine principal.Identity, Name and AuthenticationType are both "". What am I overlooking? On the premise that it is something very fundamental, I'm embarrassed to have to ask. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It is up to the host (WinForms, WPF, Uno, etc.) to set the current user. In WinForms/WPF CSLA defaults to getting the user from Or at least it used to do this. A few years ago, Microsoft changed how things work, so the current thread is no longer a reliable source for the user identity. Grumble. So, assuming CSLA 5 here, the default behavior for CSLA is still to try to get the principal from the thread. However, if your app references the You should see what context manager is being used in your app. You can do this by examining the ContextManager property of the ApplicationContext. If it is one of the types from Or, if you aren't using the |
Beta Was this translation helpful? Give feedback.
It is up to the host (WinForms, WPF, Uno, etc.) to set the current user. In WinForms/WPF CSLA defaults to getting the user from
System.Threading.Thread.CurrentThread.CurrentPrincipal
(or something along that line).Or at least it used to do this. A few years ago, Microsoft changed how things work, so the current thread is no longer a reliable source for the user identity. Grumble.
So, assuming CSLA 5 here, the default behavior for CSLA is still to try to get the principal from the thread.
csla/Source/Csla.Shared/Core/ApplicationContextManager.cs
Line 45 in dfaf152
However, if your app references the
Csla.Xaml
package, the code attempts …