Question regarding Response.WriteFile(String)

  • Thread starter Thread starter Robert Hanson
  • Start date Start date
R

Robert Hanson

Hi All,

I am using the following:

Response.WriteFile(strCompleteFileNameAndPath);

Where the strCompleteFileNameAndPath contains something like
"C:\\SimpleTest\\Bobtest.doc" and the ContentType is Application/msword.
When prompted to save the file, I see the proper file type but the file
name is MyWebpage.doc instead of BobTest.doc.

Any ideas??

Thanks for your help,

Bob Hanson
Centare Group Ltd.
 
Robert said:
Hi All,

I am using the following:

Response.WriteFile(strCompleteFileNameAndPath);

Where the strCompleteFileNameAndPath contains something like
"C:\\SimpleTest\\Bobtest.doc" and the ContentType is Application/msword.
When prompted to save the file, I see the proper file type but the file
name is MyWebpage.doc instead of BobTest.doc.

Any ideas??

1. You have mmore chances to get good ansver when you ask in proper
newsgroup. This question is Web related, and has nothing to do with C#
language.

2. Where from should your browser figure out what the file name is?
Try:
Response.Content-Type = "Application/msword";
Response.AppendHeader("Content-Disposition","Attachment; Filename" +
"\"" + MyWebpage.doc + "\"");

Vadim Chekan.
 
Back
Top