当给出没有扩展名的路径时,不会调用 IIS 6 httpmodule
我想在Windows 2003上的iis6上托管的asp.net中实现一个简单的404重定向器
我创建了一个httpmodule并在web.config中正确注册了它。当我在 VS 2005 上使用“开发服务器”(ctrl + F5) 时,重定向效果非常好。重定向适用于以下两种情况:
- 为不存在的页面 (www.example.com/page2.htm) 提供扩展时)
- 当未提供扩展时(www.example.com/abc)
但是,当我在 IIS6 上托管相同的应用程序时,方案(1)按原样工作 - 但在遇到方案时无法处理(2)
我尝试添加通配符脚本映射,但这没有帮助 - 我收到 IIS 给出的 404 错误消息。
如何处理这个问题 - web.config 或 IIS 中的某些设置?
谢谢,
I want to implement a simple 404 redirector in asp.net hosted on iis6 on windows 2003
I have created a httpmodule and properly registered it in web.config. The redirection works perfectly when I use the "development server" (ctrl + F5) on VS 2005. The redirection works for these two scenarios:
- When an extension is provided for a non-existent page (www.example.com/page2.htm)
- When an extension is NOT provided (www.example.com/abc)
However, when I host the same application on IIS6, scenario (1) works as it is - but it is not able to process when it encounters scenario (2)
I tried adding a wildcard script mapping but that is of no help - I get a 404 error message given by the IIS..
How to deal with this - some setting in web.config or IIS?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在IIS6中您可以配置要加载的404文档。请参阅http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/80cb8d8d-8fd8-4af5-bb3b-4d11fff3ab9c.mspx?mfr=true
我不认为您将能够使用 web.config 文件在 IIS6 模式下加载 404 页面,因为 ASP.NET没有集成到其中(因此甚至没有加载)。
In IIS6 you can configure the 404 document to load. See http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/80cb8d8d-8fd8-4af5-bb3b-4d11fff3ab9c.mspx?mfr=true
I don't think you'll be able to use your web.config file to load your 404 page in IIS6 mode, because ASP.NET isn't integrated into it (and thus doesn't even load).