locked
HttpHandler Chain and url rewrite RRS feed

  • Question

  • User-482944373 posted
    Hi,

    This is somewhat related to another post I did http://forums.asp.net/thread/1245790.aspx "change httphandler name of the fly"..

    the scenairo is my thumbnails  all got gerneated from this one httphandler 

    <img src="thumbnail.axd&data=blahblah" />

    the result is that all thumbnails on my webpage all has a gerenated name "thumbnail.axd.jpeg".

    <img src="thumbnail.jpeg" />  at least that's the name when I try to do "Save as Image" in the browser. I'm wondering if it's possible to filter yet another level by using url rewrite.. like so

    <img src="thumbnail.axd&data=blahblah&filename=filename" />

    and once the url rewrite module see the "filename" parameter, it'll url rewrite it somehow and the resulting images will have distinct filenames being gerneated on the webpage.

    say filenames get attached to the url is

    filename=spring
    filename=summer

    becomes

    <img src="spring.jpeg" />
    <img src="summer.jpeg" />

    thanks.
    Monday, April 3, 2006 6:41 PM

All replies

  • User90671449 posted

    Howdi do,

    Well I can't offer you exactly what you want BUT.... if you use this:

    string disheader = "inline; filename=\"" + filename + "\"";
    Response.AppendHeader("Content-Disposition", disheader);

    You'll see that when you do "Save as Image" in the browser, your filename will show up instead of the thumbnail.axd.jpeg.

    You can see it working at http://www.waterwijkers.nl/bip ...

    Cheers,

    Wes

    [edit]
    Only just noticed that IE is not always behaving as expected..... it doesn't save this header as part of the cache. So if the image comes out of the browser cache it doesn't work anymore... sigh... all other browsers behave as they should....
    [/edit]

    Tuesday, April 4, 2006 6:23 AM
  • User-482944373 posted
    THAT IS BEAUTFIUL!!! THANK YOU WES!!

    I actually saw your website before and wanted to use your control, the only thing stopped me was this generated image name. Now that I know yours do it. might as well use yours.

    Thanks a lot man. I've asked this like in then forums, you are the only one so far know how to solve this issue.

    btw, I use IE6.0 here and it works as well! :)


    Tuesday, April 4, 2006 4:50 PM
  • User90671449 posted

    Your welcome...

    I implemented this because you asked this and I thought it would be nice indeed if someone would get the original image name instead of myhandler.axd.jpg.

    So this is a great example of how input from others can lead to improvements... unfortunately not many users give me any feedback at all... sigh...

    Cheers,

    Wes

    Wednesday, April 5, 2006 4:24 AM
  • User90671449 posted

    Update:

    I've put the blaim of not handeling the naming correct on IE to soon. It's the other browsers that corrected MY mistake and IE didn't.

    I've changed the code and it does work perfectly in all browsers now..

    Cheers,

    Wes

    Friday, April 7, 2006 6:20 AM