HOW-TO: Response.BinaryWrite JPG *WITH* the original filename

D

DAC

Hello.
How can I Respose.BinaryWrite a file but preserving the original filename.

Explaining better:
Suppose a webform that displays images stored on my database. The page
shows, say, 5 pics at a time.
I want the user to be able to right-click over a pic and use "Save Picture
As..." from IE.
But, since the image is "BinaryWritten", the user gets the filename of my
image generator page. I want to force IE to use the original name for the
pic I have stored in my DB.

Besides Context.Response.ContentType = "image/jpg", is there any other
header I have to set?

Thanks in advance,
Daniel
 
S

Steve C. Orr, MCSD

This line of code should do the trick:

Response.AddHeader("Content-Disposition","inline;filename=myname.jpg");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top