Response.flush() breaking connection

Results 1 to 2 of 2

Thread: Response.flush() breaking connection

  1. #1
    Join Date
    Dec 1969

    Default Response.flush() breaking connection

    I m trying to do download of a file using ADODB.STREAM<BR>below is my code,but if i run it on local m/c then it works fine.If i run it on internet it breaks the connection after response.flush().W/o response.flush(), the code works fine on internet.can anybody tell me what is wrong.<BR><BR>*******CODE***********<BR>Set objStream = Server.CreateObject("ADODB.Stream")<BR>set flobj = server.CreateObject("Scripting.FileSystemObject")< BR>set fl = flobj.CreateTextFile(server.MapPath(folderpath) & " emp.txt",true)<BR>fl.writeline("start")<BR>objStre am.Open<BR>objStream.Type = adTypeBinary<BR><BR>objStream.LoadFromFile strPath<BR>countPos=0<BR>divisionBy =clng(objStream.Size /10)<BR>noTimes = clng(objStream.Size /divisionBy)<BR>remainingBytes = objStream.Size Mod divisionBy<BR>objStream.Position =0 <BR><BR>Response.AddHeader "content-disposition", "attachment; filename=" & strFilename<BR>Response.AddHeader "Content-Length", objStream.Size<BR><BR>for countPos = 0 to noTimes<BR>Response.BinaryWrite objStream.Read(divisionBy)<BR>Response.Flush()<BR> <BR><BR>if ((objStream.Position + divisionBy)&#062;=objStream.Size)then<BR>Response. BinaryWrite objStream.Read(objStream.Size-objStream.Position)<BR>Response.Flush()<BR>fl.writ eline "exit"<BR>exit for<BR>end if<BR>fl.writeline (countPos) & "-" & objStream.Position & "-" & FormatDateTime( now(),3)<BR>next

  2. #2
    Join Date
    Dec 1969

    Default RE: Response.flush() breaking connection

    Maybe because it&#039;s a binary stream it doesn&#039;t support flushing mid-stream.<BR><BR>A guess.<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts