【发布时间】:2018-02-09 12:05:18
【问题描述】:
我有一个 Intranet 网站,当我在本地机器上运行时,我可以获取用户的身份值。
System.Web.HttpContext.Current.User.Identity.Name.ToString().Substring(3)
但是当我在 IIS 8.5 上部署它时,它发现它是空白的。
请帮助我了解我哪里出错了?
对于模拟,我们必须使用特定的用户名和密码。
Web.config:
<system.web>
<authentication mode="Windows" />
<customErrors mode="RemoteOnly" defaultRedirect="~/Pages/Error/Error.aspx" >
<error statusCode="404" redirect="~/Pages/Error/404.aspx" />
</customErrors>
<identity impersonate="true" userName="user1" password="pass1" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
IIS 设置:
Windows authentication - Enabled
Impersonation - Enabled
Rest all disabled.
Default app pool - Integrated mode.
【问题讨论】: