473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Getting filename with webpage name using Response.WriteFile

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
filename is MyWebpage.doc instead of BobTest.doc.

Any ideas??

Thanks for your help,

Bob Hanson
Centare Group Ltd.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
3 1634
Use a line like this to specify the filename:
Response.AddHeader("Content-Disposition","attachment;filename=Bobtest.doc");

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"Robert Hanson" <bo******@att.net> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl...
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
filename is MyWebpage.doc instead of BobTest.doc.

Any ideas??

Thanks for your help,

Bob Hanson
Centare Group Ltd.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2
Thanks Steve,

This worked Great!! Can you please explain what the AddHeader method is
doing so I can have a better understanding?

Thanks again for your help!!

Bob Hanson
Centare Group Ltd.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
You're giving it the filename that you want it to use, and you're specifying
that you want the document opened externally to the browser. If you want
the document to open up inside the browser you'd specify "inline" instead of
"attachment"

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Robert Hanson" <bo******@att.net> wrote in message
news:ep**************@tk2msftngp13.phx.gbl...
Thanks Steve,

This worked Great!! Can you please explain what the AddHeader method is
doing so I can have a better understanding?

Thanks again for your help!!

Bob Hanson
Centare Group Ltd.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike Holloway | last post by:
I have an aspx page that builds an xml file. I can go to windows explorer, click on the file and select open with excel; All is fine. The file opens in excel and is displayed just as I would...
1
by: Robert Hanson | last post by:
Hi All, I am checkinf to see if there is a way to determine the Response.ContentType of a file residing on the server in order to set that property prior to issuing the...
0
by: Bill | last post by:
Hi. I have set a page that reads a file and send it to the browser with the follow commands: ........ Response.ContentType = "Application/x-msdownload"...
4
by: david | last post by:
I has a question: I can use Response.WriteFile to display images such as .jpg. But I can not us it to display words doc file in EI by calling Response.WriteFile("testdoc/DownloadLarge.doc"). It...
3
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are...
2
by: dotnettester | last post by:
Hi, I am using Response.writefile to write a file into clients browser. It works fine with files upto 60MB. When I come across a file size bigger than that, it break with error saying page can...
2
by: Alan Silver | last post by:
Hello, I have a page on a site where people can download audio files. At the moment, the link on the site sends them to a page where the download is logged in a database, then does a...
0
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) :...
4
by: AshishMishra16 | last post by:
HI friends, I am using the Flex to upload files to server. I m getting all the details about the file, but I m not able to upload it to Server. Here is the code i m using for both flex & for...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.