如何使用C#我得到当前用户名在.NET? [英] How do I get the current username in .NET using C#?
本文介绍了如何使用C#我得到当前用户名在.NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何使用C#获取当前用户名在.NET?
解决方案
字符串username = System.Security.Principal.WindowsIdentity.GetCurrent()名称。
How do I get the current username in .NET using C#?
解决方案
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
这篇关于如何使用C#我得到当前用户名在.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文