Giving file names to response streams, possible?

P

Paul L

Hi, I have some code which gets a Word document from a database, sets the
Response stream's ContentType to application/msword, and then outputs the
contents of the document to the Response stream. All that works fine, I can
open the document fine in Internet Explorer. However if I try to save the
document, the default filename is the name of the WebForm.

Is there a way to specify a name for the stream, or do I need to save the
file to the server's drive, and then redirect to that?

Thanks in advance,

Paul
 
M

Matt Berther

Hello Paul,

I think you'll need to set the Content-Disposition header.

Response.AddHeader("Content-Disposition", "inline; filename=foo.doc");
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top