Question regarding Response.WriteFile(String)

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.
 
V

Vadim Chekan

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.
 

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

Top