简体   繁体   English

ASP应用程序中的WindowsIdentity始终返回NT AUTHORITY \\ SYSTEM

[英]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 我以为应该工作的是

  • set my app's Web.config to 将我的应用程序的Web.config设置为

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身份验证 在此处输入图片说明

    • setting the application pool like this 像这样设置应用程序池

在此处输入图片说明

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启用或禁用模拟。

  1. Select the web application in IIS 在IIS中选择Web应用程序
  2. Double click on "Authentication" icon 双击“身份验证”图标
  3. Select ASP.NET Impersonation 选择ASP.NET模拟
  4. Click "Disable" or "Enable" link under actions in the right hand side panel in IIS. 单击IIS右侧面板中操作下的“禁用”或“启用”链接。
  5. This will automatically change the web.config file. 这将自动更改web.config文件。

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.

相关问题 调试模式下的 Windows.Identity 返回 NT 用户名,但在发布到服务器时返回 NT AUTHORITY\\SYSTEM - Windows.Identity in debug mode returns NT username, but returns NT AUTHORITY\SYSTEM when published to server 用户NT Authority \\ System登录失败 - Login failed for user NT Authority\System 如何在C#中获得NT授权/系统? - How can I get NT authority/system in C#? Windows安装程序使用NT AUTHORITY \\ SYSTEM而不是登录用户 - Windows installer using the NT AUTHORITY\SYSTEM instead of login user 登录失败。 用户“NT AUTHORITY\\SYSTEM”登录失败 - Login failed. Login failed for user 'NT AUTHORITY\SYSTEM' 如何使用C#在Window OS中的系统NT Authority\System下创建新用户 - How to Create New User under NT Authority\System the System in Window OS using C# 无法使用帐户 NT AUTHORITY\\SYSTEM 修改有关任务计划程序执行的文件 - Unable to modify file on task scheduler execution using account NT AUTHORITY\SYSTEM 用户“ NT AUTHORITY \\ SYSTEM”的登录失败。 原因:无法打开明确指定的数据库 - Login failed for user 'NT AUTHORITY\SYSTEM'. Reason: Failed to open the explicitly specified database 无法打开登录请求的数据库。 登录失败。 用户“ NT AUTHORITY \\ SYSTEM”的登录失败 - Cannot open database requested by the login. The login failed. Login failed for user 'NT AUTHORITY\SYSTEM' System.Data.SqlClient.SqlException:用户“NT AUTHORITY\\ANONYMOUS LOGON”登录失败 - System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM