...

View Full Version : Why Double Download Prompt



bhguo
08-01-2004, 03:28 AM
Dear Sirs:
I am developing a web application that permit user upload file to the
web server for sharing, these files are not suitable to place in a
virtual directory for hyperlink, because I have my own authority system
to control user's access. So, they will be visited through .asp page,
where I can check user's authority, then read the file's binary data and
response.binarywrite to user.
Everything is ok, but when response the file data to client IE, IE
will show twice download prompt.
Here is the sample program, showattach.asp, suppose send user the
file try.txt:

<%
'user authority .....

dim mypath,myfile
'a directory which i have grand access permit to iis anonymous user,
'but not in web directory
mypath="c:\attachfile\"
myfile="try.txt"

dim binario
response.AddHeader "Content-Disposition","attachment;filename=" & myfile
Response.Buffer = True
Const adTypeBinary = 1
Set binario = Server.CreateObject("ADODB.Stream")
binario.Open
binario.Type = adTypeBinary
binario.LoadFromFile mypath & myfile
Response.BinaryWrite binario.Read
binario.Close
Set binario = Nothing
Response.Flush
%>

The first download prompt will be "down load file showattch.asp from
xxx", let user select open,save,cancel....I think this prompt will make
user confused, why showattch.asp not try.txt directly?

If user click 'open', the second download prompt come , it say "down
load file try.txt from xxx, please select open,save,cancel....

Why it will prompt twice times? Can the first be eliminated? I hope:
Just like click on a hyperlink, no more than once prompt.

Please give me help,thanks!

bob.guo
2004 8 1

angst
08-01-2004, 07:33 PM
i just tested the script here, and it only prompts me once for download.
maybe try another web browser, i'm using IE6..



<%
'user authority .....

dim mypath,myfile
'a directory which i have grand access permit to iis anonymous user,
'but not in web directory
mypath="\home\"
myfile="test.gif"

dim binario
response.AddHeader "Content-Disposition","attachment;filename=" & myfile
Response.Buffer = True
Const adTypeBinary = 1
Set binario = Server.CreateObject("ADODB.Stream")
binario.Open
binario.Type = adTypeBinary
binario.LoadFromFile mypath & myfile
Response.BinaryWrite binario.Read
binario.Close
Set binario = Nothing
Response.Flush
%>

bhguo
08-02-2004, 04:10 PM
yes, some situation it only prompts once: Set our computer not to promt for some file type after download. In your case I guess you have set .gif file not to prompt. For example in win98, here is the position to set:
folder explore --> view --> folder option -->file type--> find .gif--> edit , is the "confirm open after download" unchecked? If it's so, that's the reason why it prompt once only--the first one.

Now the problem is: The system will have large number of user, and a few type of file are permit to save in web server , it's difficult to tell everyone to set every file type's "confirm option" in his computer ; besides the prompt I realy want to kill is the first prompt "down load file showattch.asp from xxx", The second one "down load file test.gif from xxx" is somehow resonable to user.

bob.guo
2004 8 2

Morgoth
08-02-2004, 05:30 PM
I tested the code aswell, I checked and unchecked the comfirm box for txt, and tested the code downloading c:\a\a.txt

I don't get the second prompt. I am using Windows 2000 pro (sp4), IE6.0.

The code is fine, I can't recreate the problem you are discribing.
It sounds like it's running the code twice to be able to prompt twice.

Take the code you posted, make a NEW file and run the exact code you posted, and tell me if you get two prompts with your machine. If you are testing your problem with more than the code you are showing us, that could be the code that is giving you a problem.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum