Click here to Skip to main content
15,868,292 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

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?

Anybody please help me.

Regards,

Santhosh
Posted

It has nothing to do with the registry...
What you can do is get the username for the user currently running the application...
Use WindowsIdentity[^] for that:
C#
string szUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
 
Share this answer
 
v2
You can find the current logged in user @\HKEY_CURRENT_USER\Volatile Environment\USERNAME in Windows 7.

Please check below link for additional details
Registry key for the currently logged in user[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900