要取得当前用户的信息,必须先执行下面这句代码

AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

 

然后,才可以通过

WindowsIdentity identity = WindowsIdentity.GetCurrent();

取得当前用户的凭据信息

 

也可以通过

System.Threading.Thread.CurrentPrincipal

相关文章:

  • 2021-04-06
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-07-25
猜你喜欢
  • 2021-09-10
  • 2022-01-24
  • 2022-01-25
  • 2021-10-18
  • 2021-09-20
  • 2022-12-23
相关资源
相似解决方案