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