httphandler 文件类型映射需要虚拟目录(或者确实如此吗?)

发布于 2024-08-08 21:24:05 字数 415 浏览 2 评论 0原文

我使用 httpHandler 将 *.gif 文件的所有请求传递给 ashx 处理程序。我只想对网站内的子文件夹的请求执行此操作。网站根目录称为“demo”,子文件夹称为 et。因此,我将 web.config 文件添加到 et 文件夹中,其条目如下:

这不足以将所有 *.gif 请求传递到 ashx - 我还需要添加应用程序扩展以将对 .gif 文件的请求指向 aspnet_isapi.dll。除了将 et 文件夹设置为虚拟目录(我真的不想这样做)之外,我找不到任何方法来执行此操作。无论如何,我将 et 设置为虚拟目录,然后设置映射,一切正常。如果我然后删除 et 的 virt dir 应用程序,整个事情就会继续工作。这对我来说,必须有一种方法来设置 *.gif 映射,而不必创建 virt 目录,然后再次将其删除。

有人知道这是怎么回事吗?

非常感谢。

I am using an httpHandler to pass all requests for *.gif files to an ashx handler. i only want to do this for requests to a sub-folder within the website. The website root is called 'demo' and the subfolder is called et. So, I add a web.config file to the et folder with an entry as follows:

This is not enough to pass all *.gif requests to the ashx - I also need to add an application extension to point requests for .gif files to aspnet_isapi.dll. i can't find any way to do this apart from make the et folder a virtual directory (which I don't really want to do). Anyway, I set the et to a virt dir, then set the mapping and it all works. If I then remove the virt dir app for et the whole thing keeps working. This suggests to me that there must be a way to set the *.gif mapping without having to create a virt dir and then remove it again.

Anyone know what's going on here?

Thanks very much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

韵柒 2024-08-15 21:24:05

您是否设置了 IIS 和 ASP.NET 的处理?我知道我对此有疑问,因为 IIS 在 ASP 有机会执行任何操作之前就收到了请求。

如果您使用 IIS 7.0,我建议您使用新的集成管道。这种问题很快就会消失。我成功地实现了目录的 Http 处理程序,无需执行任何特殊配置,只需将以下内容添加到 httpHandlers 节点:

  <add verb="GET" path="et/*.gif" validate="true" type="YourGifHttpHandler" />

希望有帮助。

Did you set up the handling with IIS as well as ASP.NET? I know I had issues with that because IIS gets the request before ASP has any chance to do anything about it.

If you're using IIS 7.0 I recommend you use the new integrated pipeline. This kind of issue will jsut go away. I succesfully implemented Http handlers for directories without doing anything special configuration, just add the following to the httpHandlers node:

  <add verb="GET" path="et/*.gif" validate="true" type="YourGifHttpHandler" />

Hope that helps.

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