473,406 Members | 2,293 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,406 software developers and data experts.

Basic download question

This is not an ASP.NET specific question, more of a generic HTML question.
I want to provide users a link (or a button or some control) that they can
click on to download a file. The trick is that if it's a Word or Excel
document ans the user has Word or Excell install then the file just opens
up. How do I make it so that the file prompts to save and not open the
application?

Nov 17 '05 #1
3 1054
Response.AddHeader("Content-Disposition","attachment;filename=myfile.doc");
Response.WriteFile("myfile.doc");

Here's more info:
http://msdn.microsoft.com/library/de...efiletopic.asp

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

"Buddy Ackerman" <a.********@comcast.net> wrote in message
news:u5**************@TK2MSFTNGP11.phx.gbl...
This is not an ASP.NET specific question, more of a generic HTML question.
I want to provide users a link (or a button or some control) that they can
click on to download a file. The trick is that if it's a Word or Excel
document ans the user has Word or Excell install then the file just opens
up. How do I make it so that the file prompts to save and not open the
application?

Nov 17 '05 #2
Is there a header that can be sent that will cause the file save dialog to
default to the name of the file that is actually being downloaded and not
the name of the ASPX file that's streaming the file to the client?
--Buddy
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
Response.AddHeader("Content-Disposition","attachment;filename=myfile.doc"); Response.WriteFile("myfile.doc");

Here's more info:
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwebhttpresponseclasswritefiletopic.asp
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Buddy Ackerman" <a.********@comcast.net> wrote in message
news:u5**************@TK2MSFTNGP11.phx.gbl...
This is not an ASP.NET specific question, more of a generic HTML question. I want to provide users a link (or a button or some control) that they can click on to download a file. The trick is that if it's a Word or Excel
document ans the user has Word or Excell install then the file just opens up. How do I make it so that the file prompts to save and not open the
application?


Nov 17 '05 #3
Yes, the AddHeader statement in my original response specifies the filename
for the browser to use.
Make sure you're not outputting any HTML.
You could do a Response.Clear before the AddHeader statement to help ensure
that.

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


"Buddy Ackerman" <bu***@buddyackerman.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Is there a header that can be sent that will cause the file save dialog to
default to the name of the file that is actually being downloaded and not
the name of the ASPX file that's streaming the file to the client?
--Buddy
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...

Response.AddHeader("Content-Disposition","attachment;filename=myfile.doc");
Response.WriteFile("myfile.doc");

Here's more info:

http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemwebhttpresponseclasswritefiletopic.asp

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

"Buddy Ackerman" <a.********@comcast.net> wrote in message
news:u5**************@TK2MSFTNGP11.phx.gbl...
This is not an ASP.NET specific question, more of a generic HTML question. I want to provide users a link (or a button or some control) that they can click on to download a file. The trick is that if it's a Word or Excel document ans the user has Word or Excell install then the file just opens up. How do I make it so that the file prompts to save and not open the application?



Nov 17 '05 #4

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

Similar topics

0
by: Christina | last post by:
For Immediate Release July 16, 2003 TOUCH TECHNOLOGIES, INC. RELEASES SHEERPOWER 4GL -- BEYOND BASIC AND IS AVAILABLE TO DOWNLOAD FOR FREE SAN DIEGO -- SheerPower 4GL -- Beyond BASIC is a...
5
by: Lee David | last post by:
I went to the sun site and downloaded what I hope is the development part of java. I downloaded JDK5 with Netbeans. I installed it and now have a folder in my program group "Netbeans". Is that...
4
by: Ramesh | last post by:
hi, Let me ask some basic questions. Can anybody explain me about the following questions: 1. When we have to create sn key? Whenever we compiled Component we have to create or it is a one time...
6
by: Brian Henry | last post by:
Visual Basic 2005 Express: http://download.microsoft.com/download/f/c/7/fc7debaf-4513-4300-9e6a-8fe27be88cd1/vbsetup.exe Visual C# 2005 Express:...
6
by: Tico Tech | last post by:
Hi: I have a question about the Microsoft Communications Control Version 6.0 from visual studio .net. I have this code: Dim Buffer As String Do Buffer = AxMSComm1.Input() //Error, it does...
2
by: elnahrawi | last post by:
Download ebook http://books-download.com/?Book=1487-Visual+Basic+2005+Jumpstart Okay, all you VB6 developers--time's up. As of March 2005, Microsoft no longer supports this version of Visual...
4
by: hkhellhkhell | last post by:
This is a basic overall question. Please note I am new to ASP! I am currently running IIS 5/Access 2000/Windows 2000 and have developed a web application. master/detail form, the best way...
1
by: tommak | last post by:
It's a dream of human beings to build machines that can think and behave like human beings. The most important part of of such a machine is an artificial mind that can emulate the cognitive...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.