0

I have a httphandler that is fitred for all .png files. I would to be able to rewite the name of the file into the html. Is this possible? So if test.png comes into the handler I want to write test.png?V=1

So far I have found the following:

context.Response.AddHeader("content-disposition", "inline; filename=" + context.Request.FilePath + "?V=1");
Samuel Goldenbaum
  • 18,391
  • 17
  • 66
  • 104
  • what are you really trying to accomplish? content-disposition is used by the server to signal to the browse that the response should be downloaded or saved. Normally a url request for an image file (test.png) is not a download. It may be worth it to look into URL rewriters that support redirection. – Cheeso Mar 20 '10 at 12:21
  • thanks for the reply. I am using the handler to add caching details in the reponse to ensure images are cached accordingly. In the handler I check the last modified date of the file and I want to be able to change the name of the file accordingly if the file has changed. This will forced the browser to grab a new version of the file. – Samuel Goldenbaum Mar 21 '10 at 07:44

1 Answers1

0

Yes it's possible, although I haven't done it.

You should be able to load the imgaes into memory, and serve them from there; during this process you should be able to give the file any name you like.

This will be helpful: Image from HttpHandler won't cache in browser

This page has some info on serving images via an HttpHandler (about 2/3rds into the article): http://msdn.microsoft.com/en-us/library/ms972953.aspx

Community
  • 1
  • 1
Adrian K
  • 9,880
  • 3
  • 33
  • 59