Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

AzizKamal (Programmer)
30 Dec 10 6:45
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:

Quote:


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:

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
Response.Clear

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
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
    Response.Flush

objStream.Close
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.
BigRed1212 (TechnicalUser)
30 Dec 10 11:28
New Access files have a suffix of .accdb

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

 
guitarzan (Programmer)
30 Dec 10 11:34
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
AzizKamal (Programmer)
31 Dec 10 5:37
Thanks BigRed1212 and guitarzan.

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

CODE

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??
 
AzizKamal (Programmer)
4 Jan 11 1:32
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.
AzizKamal (Programmer)
4 Jan 11 3:04
The issue finally resolved.

On application server, I changed AspBufferingLimit from 4194304 to 11194304 in metabase.xml file as mentioned here:

http://www.banmanpro.com/support2/File_Upload_limits.asp  

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