How To Ideas | How To Articles | How To Tutorials


0

How To Get UserName Of Logged In User In C#


In this article, I will tell you 3 different ways which you can use to get the User Name. Try any of the following method to get User name of currently logged in user in your Computer.

Introduction:

  1. Using Environment Class

    Environment.UserName

  2. Using SystemInformation Class

    System.Windows.Forms.SystemInformation.UserName

  3. Using WindowsIdentity Class

    string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Here is the snapshot of MessageBox showing output of these three methods
Get User Name Of Currently Logged In User - C#

Incoming search terms:

  • c# use google login (1)
  • getusername c# (1)
  • list of users connected to server using c# code (1)
  • windows connected user c# web (1)
Filed in: C# Tags: , , , , , , , , , ,

Leave a Reply

Submit Comment



© 2012 How To Ideas. All rights reserved.
Proudly designed by Theme Junkie.