Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


download ms access file to client computer

download ms access file to client computer

download ms access file to client computer

In my asp page, there is a Download button. Clicking this button downloads data from oracle to an MS-Access (.mdb) file. This file is located on server at c:\Inetpub\wwwroot\HRIS\UploadFolder and filename is NewHRISDATA.mdb.

When the data insertion in MS-Access file is done, datatoxs.asp page is displayed showing the success message and a Download File Button. Clicking Download File Button was showing File Download dialog box with Open, Save and Cancel buttons and users were saving MS-Access file to their computers using this button.

Database server, Application Server and client computer were on workgroup earlier but now active directory services are installed and now all three are on the same domain. With this change (removing computers from workgroup and joining domain), Download File Button is no more working. When the user clicks Download File button, an error displays as follows:


There is a problem with the page you are trying to reach and it cannot be displayed. HTTP 500 – Internal Server Error.

This error occurs on startDownload.asp page, which has the following code:


Response.Buffer = True
Dim strFilePath, strFileSize, strFileName

Const adTypeBinary = 1

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fileObject = fso.GetFile(Request.Form("File"))

strFilePath = Request.Form("File")
strFileSize = fileObject.size
strFileName = fileObject.Name

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath

strFileType = lcase(Right(strFileName, 4))
    Select Case strFileType
        Case ".asf"
            ContentType = "video/x-ms-asf"
        Case ".avi"
            ContentType = "video/avi"
        Case ".doc"
            ContentType = "application/msword"
        Case ".zip"
            ContentType = "application/zip"
        Case ".xls"
            ContentType = "application/vnd.ms-excel"
        Case ".gif"
            ContentType = "image/gif"
        Case ".jpg", "jpeg"
            ContentType = "image/jpeg"
        Case ".wav"
            ContentType = "audio/wav"
        Case ".mp3"
            ContentType = "audio/mpeg3"
        Case ".mpg", "mpeg"
            ContentType = "video/mpeg"
        Case ".rtf"
            ContentType = "application/rtf"
        Case ".htm", "html"
            ContentType = "text/html"
        Case ".asp"
            ContentType = "text/asp"
        Case ".mdb"
            ContentType = "application/msaccess"                        
        Case Else
            ContentType = "application/octet-stream"
    End Select
    Response.AddHeader "Content-Disposition", "attachment; filename=" & strFileName
    Response.AddHeader "Content-Length", strFileSize
    Response.Charset = "UTF-8"
    Response.ContentType = ContentType
    Response.BinaryWrite objStream.Read

Set objStream = Nothing

We also have Excel .xls files in c:\Inetpub\wwwroot\HRIS\UploadFolder and startDownload.asp is working OK for Excel Files. But it is showing error for ms access files.

RE: download ms access file to client computer

New Access files have a suffix of .accdb

Don't know if that would be the problem but it might be something to note.


RE: download ms access file to client computer

If you just want the users to be able to save the MDB file, you can try the contenttype "application/x-unknown"

And with that 500 error, it sounds like the client browser has "Show Friendly HTTP Error Messages" turned on... You can turn this off in IE under Tools > Internet Options > Advanced

RE: download ms access file to client computer

Thanks BigRed1212 and guitarzan.

I tried the contenttype "application/x-unknown":


Case ".mdb"
 ContentType = "application/x-unknown"         

but it generated the same error.

I unchecked Show friendly HTTP error messages on my computer and accessed the application through my computer as client computer. Now clicking the Download File button shows the File Download dialog box, but upon clicking Save, it stuck at Getting File Information. Filename and file size are not shown. After a while, a message displayed:

Internet Explorer cannot download startDownload.asp from server. The connection with the server was reset.

I copied the whole application files on my computer and made my computer both application server and client computer. In that case, the above code worked perfectly with no error messages?? and I downloaded the ms access file successfully.

On my computer, MS Access 2002 and MS Access 2007 are installed. When I defined tablenames and fieldnames in this .mdb file, I used MS Access 2002 at that time.

I asked our Network Administrator, and on application server, only MS Access 2007 is installed. Does this make any difference??

RE: download ms access file to client computer

I have not been able to resolve the issue as yet.

But I found more details during my testing.

It seems that the issue is not particularly related to ms-access but related to size of the file. I tried to download another ms-access mdb file from the application server. Application server was another computer and my computer was client. File size was 1.47 MB and it downloaded successfully. Then I tried to download another ms-access mdb file whose size was 6.06 MB and this file could not be downloaded.

Is there a way to increase the file download size??

On application server, windows server 2003 service pack 1 is installed. IIS version is 6.0.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close