开发者

Get Username of the Computer to know who uses the application on a local network in .NET

开发者 https://www.devze.com 2023-03-15 07:30 出处:网络
How to get username of the computer (user account) for a .NET application to use it for log table of the application. So if the application has multiple users on the LAN, I ca开发者_如何转开发n unders

How to get username of the computer (user account) for a .NET application to use it for log table of the application. So if the application has multiple users on the LAN, I ca开发者_如何转开发n understand who did what by looking at the log table. I can get machine name but I need user name of the computer because multiple users can use one computer with their own user accounts.

Thanks in advance,


string user = System.Windows.Forms.SystemInformation.UserName;


I think there is Environment class you can use, it has the Username property which shows the windows user account name

0

精彩评论

暂无评论...
验证码 换一张
取 消