如何识别运行应用程序的用户



我想在代码中检查如何识别运行应用程序的用户,我想确保应用我在 IIS 中定义的域用户

谢谢

我以前用过这个,试试它是否适合你

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

您需要:HttpContext.Current.User 或从控制器访问 HTTP 上下文。

相关内容

最新更新