0

I am working on a clients website that is coded in classic asp with iis 7.5 and windows server 2008 r2 installed on the terminal server. The problem I m experiencing is when a user tries to download a jpg file. The code is fine and was working prior to them changing servers, but now when you click the download link you get one of the following pages:

The connection was reset                       ( Firefox)
Connection closed by remote server             (  Opera )
Internet Explorer cannot display the webpage   (   ie   )

This only happens when trying to download files from these pages, all other pages are working as expected. Im completely stumped as to what the problem may be exactly and i have been at it for hours looking through forums and anything i can think of. I am guessing this is more of a back-end configuration problem, but I am not positive and have no idea what needs to change to get this working again.

User97693321
  • 3,336
  • 7
  • 45
  • 69
hijinxbassist
  • 3,667
  • 1
  • 18
  • 23

2 Answers2

0

There could be any number of problems. I recommend running a copy of Fiddler to see if there is a response error code.

Since this is classic asp, inspect the code for anything that could be hiding the error. This is going to be on error resume next. Use crude debugging techniques such as response.write "got here" or writing to a log file the progress through the code to see where the stoppage is.

It may not be IIS at all. My guess is that it is a file permission issue.

Additional Link/s to review:

How to guide for getting a classic asp application working under IIS 7.0

Community
  • 1
  • 1
Valamas
  • 24,169
  • 25
  • 107
  • 177
  • If it helps i have noticed i can download very small files ( 3KB ) but i cannot download 10KB. Its definitely a timeout issue ( or so it seems to me ). I tried adding Session.Timeout = 180 to no avail. Any possible solutions would are greatly appreciated. – hijinxbassist Sep 18 '12 at 10:13
  • timeout? does downloading a 3KB file take a long time? The 10k file is timing out? Besides size, what is different between the files. Maybe look for looping code with a condition that does not exit for the 10kb file. – Valamas Sep 18 '12 at 21:27
  • I manually set the url in the browser, it looks something like this: http://mysite/download.asp?file=pathToAfileSmallFile.jpg The connection lasts for a miniscule amount of time and thus with a small file i am able to process the request. It is instant in either case, other than the 3kb file actually prompts with the save dialog. It is a 504 error (gateway timeout). One thing i completely overlooked while posting this is that this is a migration from a 32 bit server to a 64 bit server. Seems like there is some setting i missed or maybe something in a config file that needs to change. – hijinxbassist Sep 19 '12 at 00:57
  • Very nicely summed up article, thank you. We do have most of the steps suggested implemented, but the app pool user instead of anon sounds very promising. Im going to get up early, been up for 33hrs now hacking away at the workload. i appreciate you helping me with this, ill post back in the am when im fresh and hopefully i can check this off my long list of to-dos. Thanks again. – hijinxbassist Sep 19 '12 at 05:40
  • The problem was solved by an outside tech. When i find out the solution they implemented i will post back. – hijinxbassist Sep 21 '12 at 23:27
  • great! how about a +1 for trying to help. – Valamas Sep 23 '12 at 21:48
0

This code works for me on iis 7.5 win2k8r2:


Sub s_getFile(sPath, sfilename, sBaseName)

Response.Buffer = False 
Server.ScriptTimeout = 30000 

Response.ContentType = "application/x-unknown" 

Response.AddHeader "Content-Disposition", "attachment; filename=" & sfilename 

Set adoStream = CreateObject("ADODB.Stream") 

adoStream.Open() 
adoStream.Type = 1 
adoStream.LoadFromFile(sPath & "\" & sBaseName) 

iSz = adoStream.Size 

Response.AddHeader "Content-Length", iSz may be required

chunk = 2048 
For i = 1 To iSz \ chunk 
    If Not Response.IsClientConnected Then Exit For 
    Response.BinaryWrite adoStream.Read(chunk) 
Next 

If iSz Mod chunk > 0 Then 
    If Response.IsClientConnected Then 
        Response.BinaryWrite adoStream.Read(iSz Mod chunk) 
    End If 
End If 

adoStream.Close 
Set adoStream = Nothing 

Response.End 
End Sub 
Luca
  • 9,259
  • 5
  • 46
  • 59
Alex
  • 1