我希望这不是悖论,但我不知道该怎么做......
我有一个带有以下 Web.Config 条目的 VS2008 ASP.NET MVC 项目:
<authentication mode="Windows">
<forms name=".ADAuthCookie" timeout="10" />
</authentication>
这使得访问者使用他们用于登录 Windows 的 DOMAIN\username 登录名自动登录。(对?)
这适用于我的开发服务器 ( http://localhost:xxxx ),但不适用于我的 IIS 服务器 ( http://localhost )。可能是因为开发服务器是由我的本地用户(在域上具有 ActiveDirectory 读取权限)“启动”的,并且因为 IIS 是由没有的 IUSR_WORKSTATION 用户“启动”的。(对?)
如果以上所有情况都成立,我如何模拟 IIS 用户(例如我自己的用户名)以仅使用 Windows 登录名对当前用户进行身份验证?(像下面的例子)?
还是应该授予 IUSR_WORKSTATION 用户 ActiveDirectory?读取权限(不是首选,因为我会经常切换服务器/IUSR_ 用户)
<identity impersonate="true" userName="DOMAIN\myuser" password="mypass"/>
<authentication mode="Windows">
<forms name=".ADAuthCookie" timeout="10" />
</authentication>
<identity impersonate="false"/>