views:

109

answers:

1

I have a url similar to /abc/1.png i then rewrite it to /full/path/1.png. However it seems like the mime is being clobbered because when hitting view image with firefox i get a download instead of a page with the image. How do i solve this? I am using C# and ASP.NET you can view this post for more details http://stackoverflow.com/questions/1025013/why-are-image-acting-as-downloads/1025035

+1  A: 

I suspect that the MIME type of your friendly name is not correct? Can you show an example of the code you are using to render your friendly name version of the image?

Updated:

If your site is trying to serve images directly from asp.net code you need to set the response headers with the mime type of the image you're trying to return...

John Weldon
It was in that link http://stackoverflow.com/questions/1025013/why-are-image-acting-as-downloads/1025035 pre rewrite its .../xyz.png, postrewrite is .../number.png
acidzombie24
so... xyz.png is being handled as an asp.net page? the code in the link shows the current request being re-written, which indicates to me that the current request is being handled by asp.net rather than just as an image? What is the url in the browser, and what asp code is rewriting the request?
John Weldon
That makes some sense, that its being caught but ASP and being treated as an ASP page. Do you know how to do what i am trying to do post or send me an email and i'll send a piece of code. Essentially i generate a file image /a/sub/id/title.ext and map it to /path/id.ext (png, jpg, etc). The thing bothering me the most is that it finds/displays the image perfectly but doesnt send the correct mime (i actually dont know if mime is the problem).
acidzombie24
[email protected] ... I can't promise getting back to you tonight but I can probably send a reply tomorrow some time...
John Weldon
I'll need a day or two to make improvements and cleanup my code before i send that email.
acidzombie24