locked
Handle filetype like jpg, gif,... ? RRS feed

  • Question

  • User1518238521 posted
    I added a UrlRewrite module into my app, and catch all image link and process it. The problem is all image links doesn't fall into my code. I think it's about ISAPI problem.
    How can I solve this with configuring IIS ? and How can I sove this without configuring IIS (when using remote hosting, for example).

    Thanks in advanced.
    Tuesday, June 6, 2006 7:30 AM

All replies

  • User-1624456073 posted
    You're right about it being an isapi problem. What you need to do, is make sure ASP.NET gets the request for the file type from iis. This you do by registering an isapi filter for f.ex .jpeg and .gif, forwarding these requests to aspnet_isapii.dll which you'll find in the framework installation folder. Then, assuming you've configured your handlers in the web.config, they will get the requests.

    Have a look at this article, it might be useful :)

    With remote hosting I don't know, I assume either their control panel will let you do the required configuration, or you'll have to contact their tech support and have them do it for you.

    Hope that helps :)


    Tuesday, June 6, 2006 9:25 AM
  • User1518238521 posted

    Thanks I got it. But after all, there's no way to do this without configuring IIS. How about I want to programmatically handle files whose extension exists in my database ? So everytime I add an extension record into database, I have to configure IIS ?

    Tuesday, June 6, 2006 11:27 AM
  • User-2001980297 posted

    You have to configure IIS and there is no way to avoid that.

    If you do not like to configure IIS frequently, you can map * to asp.net isapi instead map each extension one by one. (In IIS6, you should use wildcard). Then you can choose how to handle each extension in web.config. That is quite easy.

    Tuesday, June 6, 2006 10:04 PM
  • User-1143650407 posted
    I added a ".jpg" mapping to IIS and my httphandler did not work. The image displayed as if there was no httphandler.

    How I set up mapping: application folder > properties > configuration > add. (Use IIS 5)
    This article helped me along (not doing this example):
    http://www.c-sharpcorner.com/Code/2003/June/HTTPHandlersForImages.asp

    I know my handler works because I tried it on an extension already mapped (modified the path expression in web.config) and I got the text part of the result.

    Why did the mapping configuration not work?
    Tuesday, August 15, 2006 8:41 PM