ContentType Issues w/Page Titles

  • Thread starter Thread starter Jeffrey A. Voigt
  • Start date Start date
J

Jeffrey A. Voigt

Currently, if I change content type to word and send trough the stream a
word document, the page title shows [aspx page name - Microsoft Word]. Is
there any way I can change that in the code to the file name that I'm
sending through the stream?

Here is the code in question.

Response.ContentType = "text/html";
Response.OutputStream.Write(file,0,(int)ws.ResponseSoapContext.Attachments[0
].Stream.Length);

Response.End();

Any help would be appreciated.

Thanks,
- J
 
Jeffrey A. Voigt said:
Currently, if I change content type to word and send trough the stream a
word document, the page title shows [aspx page name - Microsoft Word]. Is
there any way I can change that in the code to the file name that I'm
sending through the stream?

Here is the code in question.

Response.ContentType = "text/html";
Response.OutputStream.Write(file,0,(int)ws.ResponseSoapContext.Attachments[0
].Stream.Length);

Response.End();

Any help would be appreciated.

Thanks,
- J

See "Content-Disposition" http-header.
I think you need a value of "inline; filename=<yourfile.ext>"
(and of course, replace the "<yourfile.ext>" bit)

Hans Kesting
 
I've done what you have suggested and it is still not working for some
reason. Here is the code now:

// write out the file contents

Response.OutputStream.Write(file,0,(int)ws.ResponseSoapContext.Attachments[0
].Stream.Length);


// add a header to the output stream to show the correct file name

// rather than LoadDoc.aspx

Response.AddHeader(

"Content-Disposition",

"inline; filename=" + strFileName + ";" );


Response.End();



Any other suggestions?

Thanks,
- J

Hans Kesting said:
Jeffrey A. Voigt said:
Currently, if I change content type to word and send trough the stream a
word document, the page title shows [aspx page name - Microsoft Word]. Is
there any way I can change that in the code to the file name that I'm
sending through the stream?

Here is the code in question.

Response.ContentType = "text/html";
Response.OutputStream.Write(file,0,(int)ws.ResponseSoapContext.Attachments[0
].Stream.Length);

Response.End();

Any help would be appreciated.

Thanks,
- J

See "Content-Disposition" http-header.
I think you need a value of "inline; filename=<yourfile.ext>"
(and of course, replace the "<yourfile.ext>" bit)

Hans Kesting
 
Back
Top