[英]WindowsIdentity in asp application always returns NT AUTHORITY\SYSTEM
I have read a lot of suggestion over the past few days on how to get the current user in my asp application (developed using devexpress xaf) but so far nothing has worked for me. 过去几天,我已经阅读了很多关于如何在asp应用程序(使用devexpress xaf开发)中获取当前用户的建议,但是到目前为止,对我来说没有任何帮助。 The return values of
的返回值
WindowsIdentity.GetCurrent().Name
is always NT AUTHORITY\\SYSTEM. 始终为NT AUTHORITY \\ SYSTEM。 I tried suggestions like this and a couple found in the devexpress forum.
我想建议,像这种并在DevExpress的论坛上发现一对夫妇。
What i've thought should be working is 我以为应该工作的是
include 包括
<system.web>
<authentication mode="Windows" />
<identity impersonate="true" />
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
</system.web>
(i've also tried setting imporsonation above to false but without change) (我也尝试将上面的人工翻译设置为false,但没有更改)
setting my site in IIS to use Windows Authentication 在IIS中设置我的网站以使用Windows身份验证
But the result remains always NT AUTHORITY\\SYSTEM. 但是结果始终是NT AUTHORITY \\ SYSTEM。
Since the "NT AUTHORITY\\SYSTEM" is member of "Builtin\\Administrator" SYSADMIN server role is granted by default. 由于“ NT AUTHORITY \\ SYSTEM”是“ Builtin \\ Administrator”的成员,因此默认情况下授予SYSADMIN服务器角色。 By default, the Local System Account is a member of the local Administrators group and is therefore a member of the sysadmin group in SQL Server.
默认情况下,本地系统帐户是本地Administrators组的成员,因此是SQL Server中sysadmin组的成员。
To enable impersonation, set impersonate="true" for the identity element in web.config. 要启用模拟,请在web.config中为identity元素设置impersonate =“ true”。
<system.web>
<identity impersonate="true" />
</system.web>
Impersonation can also be enabled or disabled from IIS. 还可以从IIS启用或禁用模拟。
set the "Managed pipeline mode" of the DefaultAppPool to "Classic". 将DefaultAppPool的“托管管道模式”设置为“经典”。
Run the application, and notice that, the application code, is now executed, using 'NT AUTHORITY\\IUSR' account, instead of 'IIS APPPOOL\\DefaultAppPool' 运行该应用程序,并注意,现在使用“ NT AUTHORITY \\ IUSR”帐户而不是“ IIS APPPOOL \\ DefaultAppPool”执行了应用程序代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.