Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Why Double Download Prompt

    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

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    i just tested the script here, and it only prompts me once for download.
    maybe try another web browser, i'm using IE6..

    Code:
    <%
    '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
    %>

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    yes, some situation it's true but ....

    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

  • #4
    Senior Coder Morgoth's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada Remaining Brain Cells: 6
    Posts
    1,402
    Thanks
    2
    Thanked 1 Time in 1 Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •