Giving file names to response streams, possible?

  • Thread starter Thread starter Paul L
  • Start date Start date
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
 
Hello Paul,

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

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