24
A
回答
40
System.Security.Principal.WindowsIdentity.GetCurrent().Name
我還發現:
Environment.UserName
或
System.Windows.Forms.SystemInformation.UserName
我不能嘗試它,以便檢查自己的結果。
補充: 完整的用戶名:
Imports System.DirectoryServices.AccountManagement
Dim userFullName As String = UserPrincipal.Current.DisplayName
7
呼叫WindowsIdentity.GetCurrent()
獲得Windows用戶身份。
您可以從中獲得該名稱。
相關問題
- 1. 如何獲取Windows用戶名
- 2. 如何獲取Windows用戶名
- 3. 如何獲取Windows Azure移動服務用戶的用戶名?
- 4. 如何獲取當前Windows登錄用戶的用戶名?
- 5. 在Spring MVC中獲取Windows用戶名
- 6. 如何在silverlight中獲取Windows的當前用戶名?
- 7. 如何在python中獲取Windows用戶的全名?
- 8. 如何在Windows中獲取登錄用戶的全名?
- 9. 如何在Windows中獲取當前登錄用戶的域名?
- 10. 如何在Perl中的Windows上獲取系統用戶全名?
- 11. 如何獲取Makefile中的用戶名?
- 12. 如何獲取用戶名?
- 13. 獲取Intranet的Windows用戶名
- 14. 如何在Java中獲取Windows用戶名?
- 15. 如何在Oracle APEX中獲取windows用戶名和密碼?
- 16. 如何在Windows Powershell中獲取Azure Active Directory用戶名?
- 17. 如何使用.Net CF 3.5獲取PDA/Windows Mobile的用戶名?
- 18. 使用Windows Azure獲取Facebook用戶名
- 19. 如何獲取登錄的Windows用戶的名字和姓氏?
- 20. 在Windows中獲取登錄用戶的用戶名/密碼
- 21. 如何在wordpress中獲取用戶名?
- 22. 如何在global.asax中獲取用戶名
- 23. 如何在Python中獲取用戶名?
- 24. 如何獲取java中的windows賬戶名稱
- 25. 獲取windows用戶名和javascript
- 26. 獲取Windows用戶名以NaCl nexe
- 27. 獲取用戶名asp.net windows auth
- 28. 獲取Windows登錄用戶名ASP .net
- 29. 獲取Windows用戶名和密碼
- 30. 獲取Windows用戶顯示名稱
System.Security.Principal.WindowsIdentity.GetCurrent()。Name,This one is working謝謝 – Ujjwal27 2013-04-29 08:18:24
如何獲得完整的用戶名而不是用戶ID示例:而不是顯示Ujjwal27顯示「Ujjwal Vaddepati」 – Ujjwal27 2013-04-29 09:28:19
System .DirectoryServices.AccountManagement.UserPrincipal.Current.UserPrincipalName對於在ADAL中提供有意義的提示也很有用。 – 2014-01-10 20:53:15