473,320 Members | 1,804 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,320 software developers and data experts.

Downloading files - prompt shown twice

Hi, I have the following code to prompt the user for a download:
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AppendHeader("Content-Disposition", "attachment;filename=test.pdf")
Response.WriteFile("C:\test.pdf")
Response.End()

This works well, as far as prompting the user for download.

However, if I chose "Open", I then get the same prompt again. If I chose 'Open' the second time,then the file actually gets downloaded and opened.

This double prompt issue does not happen if i chose Save. This works as expected.

Anyone know what's going on?
Nov 17 '05 #1
1 2154
Is this code in the same page as the link to download the file?

When the download link/button is clicked try opening a new window with the code below in it.

--
S. Justin Gengo, MCP
Web Developer / Programmer

Free Code Library At:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Marina" <zl*******@nospam.hotmail.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi, I have the following code to prompt the user for a download:
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AppendHeader("Content-Disposition", "attachment;filename=test.pdf")
Response.WriteFile("C:\test.pdf")
Response.End()

This works well, as far as prompting the user for download.

However, if I chose "Open", I then get the same prompt again. If I chose 'Open' the second time,then the file actually gets downloaded and opened.

This double prompt issue does not happen if i chose Save. This works as expected.

Anyone know what's going on?
Nov 17 '05 #2

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

Similar topics

12
by: zhi | last post by:
Really confused, when I use keyword style argument as following: >>> input(prompt="hello") Traceback (most recent call last): File "<pyshell#52>", line 1, in -toplevel- input(prompt="hello")...
0
by: Xavier Osa | last post by:
Hi, I have an ASP.Net web page that you can download a file. As Fergunson's problem, it prompts twice dialog boxes only if I select Open button. If I select Save button, it prompts once. I'm...
7
by: theyas | last post by:
How can I get my code to NOT display two "Open/Save/Cancel/More Info" dialog boxes when using the "Response.WriteFile" method to download a file to IE I've asked about this before and didn't get a...
5
by: fniles | last post by:
We created an ActiveX control and marked it as safe for scripting using Implements IObjectSafety. We then created a CAB file and signed it using Verisign. We also created a license file (LPK file)...
1
by: tshad | last post by:
I have some code to allow me to send text files to my user. I am not allowing them to view my directory. I am just downloading a file they previously requested, which works some of the time. ...
0
by: Xah Lee | last post by:
Interactive Find and Replace String Patterns on Multiple Files Xah Lee, 2006-06 Suppose you need to do find and replace of a string pattern, for all files in a directory. However, you do not...
6
by: Shooter4Life8 | last post by:
Hi, I am having trouble figureing out the best way to open a command prompt then write lines to it in VB.NET. Currently I have this code, but it execute's too fast I think because Dim psi As...
7
by: Steve | last post by:
Hello, I am a beginner/intermediate c++ coder. I have a program that I am writing and would like to be able to distribute to some of my friends. The problem with this is that the data files...
0
by: jannyguy | last post by:
Hi, I have a web application running on an apache server. It has a download link for downloading a file. My requirement is to download this file without asking the user where to download....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.