How do I get the logged in user's window's credentials in a WPF application

你离开我真会死。 提交于 2019-11-28 00:03:50

问题


I have a little application I build that monitors tickets submitted. It basically just sits there in the corner and notifies when new tickets arrive. I need to get the persons username who is logged into the computer to pull their tickets.

I tried searching, but I think I'm using the wrong terminology as I couldn't really find anything.


回答1:


You're looking for the Environment.UserName property.

You may also be looking for the Environment.UserDomainName property.




回答2:


Try System.Security.Principal.WindowsIdentity.GetCurrent().Name



来源:https://stackoverflow.com/questions/2885637/how-do-i-get-the-logged-in-users-windows-credentials-in-a-wpf-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!