bhguo
08-01-2004, 02: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
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