I'm trying the get the user's name [ex) admin, John, Lucy, etc.] so I can store it to a string and create a file path to save files in my application. I have absolutely no idea how to do this. I tried using the
Try this to get the username of the currently logged on user:
string username = Environment.UserName;
This is in the system namespace, so there's no need to use Windows Identity.