当给出没有扩展名的路径时,不会调用 IIS 6 httpmodule

发布于 2024-12-22 22:27:18 字数 427 浏览 3 评论 0原文

我想在Windows 2003上的iis6上托管的asp.net中实现一个简单的404重定向器

我创建了一个httpmodule并在web.config中正确注册了它。当我在 VS 2005 上使用“开发服务器”(ctrl + F5) 时,重定向效果非常好。重定向适用于以下两种情况:

  1. 为不存在的页面 (www.example.com/page2.htm) 提供扩展时)
  2. 当未提供扩展时(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:

  1. When an extension is provided for a non-existent page (www.example.com/page2.htm)
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨曦慕雪 2024-12-29 22:27:18

在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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文