How do I get the current username in .NET using C#?

后端 未结 18 1731
忘了有多久
忘了有多久 2020-11-22 09:59

How do I get the current username in .NET using C#?

18条回答
  •  日久生厌
    2020-11-22 10:07

    Use System.Windows.Forms.SystemInformation.UserName for the actually logged in user as Environment.UserName still returns the account being used by the current process.

提交回复
热议问题