asp force download

Discussion in 'ASP General' started by Guoqi Zheng, Jan 14, 2004.

  1. Guoqi Zheng

    Guoqi Zheng Guest

    Dear Sir,

    I made a force download in ASP. For other types of file, everything works
    ok. but for .txt, .html this kind of file. it always return an error, file
    not found. can someone point out what I did wrong here?

    The following is my script

    strContentType = "application/octet-stream"
    abcFile = "filename="&objRs("DocumentName")

    response.AddHeader "Content-Disposition", abcFile
    response.contenttype=strContentType
    response.binarywrite getBinaryFile(FileName)

    function getBinaryFile(fileSpec)
    Dim adTypeBinary
    adTypeBinary = 1
    Dim oStream
    set oStream = server.createobject("ADODB.Stream")
    oStream.Open
    oStream.Type = adTypeBinary
    oStream.LoadFromFile fileSpec
    getBinaryFile= oStream.read
    set oStream=nothing
    end function


    --
    Met vriendelijke groet,

    Guoqi Zheng
    Tel: +31 (0) 23 5343545
    http://www.meetholland.com
    Guoqi Zheng, Jan 14, 2004
    #1
    1. Advertising

  2. Guoqi Zheng

    Ray at Guest

    "Guoqi Zheng" <> wrote in message
    news:...
    > Dear Sir,
    >
    > I made a force download in ASP. For other types of file, everything works
    > ok. but for .txt, .html this kind of file. it always return an error, file
    > not found. can someone point out what I did wrong here?
    >


    What error? And I think you should be returning those file types as
    "adTypeText" (2).

    Ray at home
    Ray at, Jan 14, 2004
    #2
    1. Advertising

  3. Guoqi Zheng

    Guoqi Zheng Guest

    The error I got is "page not found", I don't really understand it. I will
    try to test by adTypeText
    Thanks

    "Ray at <%=sLocation%>" <myFirstNameATlane34dotKOMM> wrote in message
    news:#...
    >
    > "Guoqi Zheng" <> wrote in message
    > news:...
    > > Dear Sir,
    > >
    > > I made a force download in ASP. For other types of file, everything

    works
    > > ok. but for .txt, .html this kind of file. it always return an error,

    file
    > > not found. can someone point out what I did wrong here?
    > >

    >
    > What error? And I think you should be returning those file types as
    > "adTypeText" (2).
    >
    > Ray at home
    >
    >
    Guoqi Zheng, Jan 14, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PJS

    Force Download - XML problem

    PJS, Jul 18, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    515
  2. Ken Cox [Microsoft MVP]

    Re: Force File Download XML Problem

    Ken Cox [Microsoft MVP], Jul 19, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    700
  3. JP SIngh

    ASP Force Download of file from webserver

    JP SIngh, Jun 21, 2005, in forum: ASP General
    Replies:
    2
    Views:
    194
    Bullschmidt
    Jun 30, 2005
  4. JP SIngh

    Force a file download from ASP Page

    JP SIngh, Sep 15, 2006, in forum: ASP General
    Replies:
    1
    Views:
    156
    Patrice
    Sep 15, 2006
  5. Navin
    Replies:
    1
    Views:
    172
    Grant Wagner
    Aug 28, 2003
Loading...

Share This Page