ASP.NET Windows 身份验证在 IIS 7.5 中不起作用
因此,我有一个使用 Windows 身份验证的 ASP.NET 站点,它只执行一件事:
protected void Page_Load(object sender, EventArgs e)
{
somelabel.Text = HttpContext.Current.User.Identity.IsAuthenticated.ToString();
return;
}
不幸的是,由于某种原因它总是错误的。这是我的 web.config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Windows"/>
<authorization>
<allow users="*"/>
</authorization>
<customErrors mode="Off"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
,我将其部署在运行 IIS 7.5 的 Windows 7 上。
- Windows 身份验证已安装并启用
- 目标框架是 4.0
- 应用程序池管道已集成
- Windows 身份验证中的扩展保护是“关闭”和“接受”(两者都尝试过)
So I have a ASP.NET site that use Windows Authenication that only does one thing:
protected void Page_Load(object sender, EventArgs e)
{
somelabel.Text = HttpContext.Current.User.Identity.IsAuthenticated.ToString();
return;
}
Unfortunately it is always false for some reason. Here is my web.config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Windows"/>
<authorization>
<allow users="*"/>
</authorization>
<customErrors mode="Off"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
I deployed it on my Windows 7 running IIS 7.5.
- Windows Authentication is installed and enabled
- Target framework is 4.0
- Application pool pipeline thing is integrated
- Extended protection in Windows Authentication is "off" and "accept" (tried both)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将授权部分更改为:
我认为通过说
allow users="*"
您就允许每个主体访问。请参阅 斯科特·格思里
Change the authorization section to:
I think that by saying
allow users="*"
you are allowing every body access.See this post by Scott Guthrie