How to know if a guest user is running the application - c#?

有些话、适合烂在心里 提交于 2019-12-06 06:02:32

Here's an optimized version of what Barry said.

   if (System.Security.Principal.WindowsIdentity.GetCurrent().IsGuest)
   {
     //User is Guest
   }
if (System.Security.Principal.WindowsIdentity.GetCurrent().IsGuest == true)
   {
     //User is Guest
   }

That would depend entirely on how your users are setup. You could use group membership to determine if a user is a Guest or they might be using the Guest account (although some organisations might disable that one).

Are you using Domain Auth? If you are using Domain Auth, get the current user details with

Environment.UserName or Enviroenment.UserDomainName;

and check if user is a member or not.

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