httphandler filetype mapping requires virtual directory (or does it?)
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开发者_如何学JAVA 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.
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.
精彩评论