C#如何判断当前用户是否输入某个域
2023-07-06
代码如下:
WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent();
WindowsPrincipal currentPrincipal = new WindowsPrincipal(currentIdentity);
if (currentPrincipal.IsInRole(@”HZDomain Users”))
this.button1.Text = “YEAH!”;