Downloading a mdb file.

Discussion in 'ASP General' started by Yan Roosens, Jun 12, 2004.

  1. Yan Roosens

    Yan Roosens Guest

    Hi all,

    I try to download a mdb file. If I simply display a link to the file,
    the right-click/Save Target As doesn't work.
    I couild rename the mdb file into a zip file, I think the download would
    work, but the user would have to rename the zip file into a mdb file,
    and I try to avoid this.

    Here is the code I have so far:

    <%
    Response.ContentType = "text/plain"
    Response.AddHeader "Content-Transfer-Encoding", "binary;"
    Response.AddHeader "Content-Disposition", "attachment;
    filename=backup.mdb;"

    thepath = server.mappath("/") & "\test\backup.mdb"

    Set fsob = Server.CreateObject("Scripting.FileSystemObject")
    set thefile = fsob.OpenTextFile(thepath)
    response.BinaryWrite(thefile.ReadAll)

    set fsob = Nothing
    set thefile = Nothing
    %>

    The file is downloaded and saved on the local HD, but it is corrupted
    and I can't open it with Access.
    The mdb file on the server is 2,7 Mb and the locally saved file is 5,3
    Mb.

    I don't know exactly where is the problem. In the ContentType, in the
    Encoding?
    Or maybe the problem is in the OpenTextFile? Not the right way to open a
    mdb file?

    Does anybody know how to fix this code?

    TIA
    Yan
    Yan Roosens, Jun 12, 2004
    #1
    1. Advertising

  2. Yan Roosens

    Slim Guest

    "Yan Roosens" <> wrote in message
    news:...
    > Hi all,
    >
    > I try to download a mdb file. If I simply display a link to the file,
    > the right-click/Save Target As doesn't work.



    it works when i try it






    > I couild rename the mdb file into a zip file, I think the download would
    > work, but the user would have to rename the zip file into a mdb file,
    > and I try to avoid this.
    >
    > Here is the code I have so far:
    >
    > <%
    > Response.ContentType = "text/plain"
    > Response.AddHeader "Content-Transfer-Encoding", "binary;"
    > Response.AddHeader "Content-Disposition", "attachment;
    > filename=backup.mdb;"
    >
    > thepath = server.mappath("/") & "\test\backup.mdb"
    >
    > Set fsob = Server.CreateObject("Scripting.FileSystemObject")
    > set thefile = fsob.OpenTextFile(thepath)
    > response.BinaryWrite(thefile.ReadAll)
    >
    > set fsob = Nothing
    > set thefile = Nothing
    > %>
    >
    > The file is downloaded and saved on the local HD, but it is corrupted
    > and I can't open it with Access.
    > The mdb file on the server is 2,7 Mb and the locally saved file is 5,3
    > Mb.
    >
    > I don't know exactly where is the problem. In the ContentType, in the
    > Encoding?
    > Or maybe the problem is in the OpenTextFile? Not the right way to open a
    > mdb file?
    >
    > Does anybody know how to fix this code?
    >
    > TIA
    > Yan
    >
    Slim, Jun 13, 2004
    #2
    1. Advertising

  3. Yan Roosens

    Bullschmidt Guest

    Right-click/Save Target As on a regular link to an .mdb file should
    work.

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Consultant
    http://www.Bullschmidt.com
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Bullschmidt, Jun 16, 2004
    #3
  4. Yan Roosens

    Yan Roosens Guest

    Hi Paul,

    Bullschmidt wrote:

    > Right-click/Save Target As on a regular link to an .mdb file should
    > work.


    It should....but it doesn't.
    Could it be because Access is not installed on the client?

    I have tried with a text file and jpg file, it works as expected.

    Thank you for the response.
    Yan
    Yan Roosens, Jun 16, 2004
    #4
  5. Yan Roosens

    dlbjr Guest

    If you have a web page with a link to it then it can be downloaded.
    The referrer will allow it. No referrer = no download.

    Example htm page:

    <a href="data.mdb">Download database file</a>

    'dlbjr

    'Unambit from meager knowledge of inane others,engender uncharted sagacity.
    dlbjr, Jun 17, 2004
    #5
  6. Yan Roosens

    Yan Roosens Guest

    Hello,

    Bullschmidt wrote:

    > Right-click/Save Target As on a regular link to an .mdb file should
    > work.


    I have tried to download from a client with Access installed, and it
    doesn't work.
    So the problem is on the server. I will post in a IIS related news
    group.

    Thank you anyway.
    Yan
    Yan Roosens, Jun 17, 2004
    #6
    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. A.M

    Creating an MDB/XLS file

    A.M, Oct 28, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    4,197
    Chris Becker
    Oct 30, 2003
  2. =?Utf-8?B?UGhpbA==?=

    Faster access to MDB? MS Access MDB and ASP

    =?Utf-8?B?UGhpbA==?=, Jan 26, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    452
    Kevin Spencer
    Jan 27, 2005
  3. Praveen
    Replies:
    1
    Views:
    733
    Kevin Yu [MSFT]
    Apr 16, 2005
  4. John  Schult

    MDB to MDB Event Notification

    John Schult, May 4, 2005, in forum: Java
    Replies:
    0
    Views:
    459
    John Schult
    May 4, 2005
  5. Praveen
    Replies:
    5
    Views:
    160
    Kevin Yu [MSFT]
    Apr 20, 2005
Loading...

Share This Page