gpt4 book ai didi

asp.net - 删除 ASP.NET/IIS 7 应用程序中特定路径的 HttpModule?

转载 作者:行者123 更新时间:2023-12-04 16:13:13 24 4
gpt4 key购买 nike

最简洁地说,我的问题是在 IIS 7 集成模式下运行的 ASP.NET 4.0 应用程序是否应该能够支持我的 Web.config 文件的这一部分:

  <location path="auth/windows">
<system.webServer>
<modules>
<remove name="FormsAuthentication"/>
</modules>
</system.webServer>
</location>

我正在尝试混合模式身份验证(Windows 和窗体 - 我知道关于该主题的 S.O. 还有其他问题)。使用 IIS 管理器,我禁用了对 auth/windows/winauth.aspx 的匿名身份验证,它位于上面的位置路径中。我设置了失败的请求跟踪来跟踪各种 HTTP 状态代码,包括 302。

当我请求 winauth.aspx 页面时,返回 302 HTTP 状态代码。如果我查看请求跟踪,我可以看到 401(未经授权)最初是由 AnonymousAuthenticationModule 生成的。但是,FormsAuthenticationModule 将其转换为 302,这是浏览器看到的。因此,似乎我试图从该路径中页面的管道中删除该模块的尝试不起作用。但我在任何地方都没有看到任何表明它是无效配置的投诉(事件查看器、死亡黄页等)。我希望将 401 返回到浏览器,其中可能包含适当的 WWW-Authenticate header 。

其他几点:a) 我有 <authentication mode="Forms">在我的 Web.config 中,这就是 302 重定向到的内容; b) 我得到了要从 inetserv\config\applicationHost.config 文件中删除的模块的“名称”; c) 我的 Web.config 文件中有这个元素: <modules runAllManagedModulesForAllRequests="false"> .

有人以这种方式删除模块有任何运气吗?

最佳答案

与其删除模块,不如删除该路径的表单例份验证?

  <location path="auth/windows"> 
<system.Web>
<authentication mode="None"/>
</system.Web>
</location>

关于asp.net - 删除 ASP.NET/IIS 7 应用程序中特定路径的 HttpModule?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3057646/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com