Search code examples
c#windows-store-apps

How to find logged in user from Windows Registry?


am developing a windows store 8.1 app using C# and xaml.

In my app I want to find logged in user name from Windows Registry.

How can I get that from C# code?


Solution

  • You can find the user name in HKEY_CURRENT_USER\Volatile Environment\USERNAME. However, I'm pretty sure you won't be able to access this from a Windows Store App.

    I'd suggest looking at the UserInformation.GetDomainNameAsync method or other methods in the UserInformation class instead.