Files being written to Response.OutputStream hang 25% of the time

Discussion in 'ASP .Net' started by Chris Ashley, Dec 5, 2007.

  1. Chris  Ashley

    Chris Ashley Guest

    I'm writing files directly to Response.OutputStream... setting the
    headers like so:

    HttpContext.Current.Response.Buffer = false;
    HttpContext.Current.Response.Clear();
    HttpContext.Current.Response.ContentType = "binary/octet-
    stream";
    HttpContext.Current.Response.AddHeader("content-disposition",
    "attachment;filename=" + strOutputFilename);
    long lngSize = GetFileSize(strFTPURL, strFileName);
    HttpContext.Current.Response.AddHeader("Content-Length",
    lngSize.ToString());
    HttpContext.Current.Response.Flush();

    BeginDownloadToStream(HttpContext.Current.Response.OutputStream,
    strFileName);

    About 25% of the time, when the user downloads the file, the file
    download box hangs at 99%.

    If the user then clicks cancel and tries to download the same file
    again, it works every single time.

    Problem is not isolated to any particular file... just happens 25% of
    the time with random files, and always works the second time around.

    No exceptions are being thrown anywhere, so I'm at a loss as to what
    is going wrong...

    anybody have any ideas?
     
    Chris Ashley, Dec 5, 2007
    #1
    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. Jenny

    Response.OutputStream

    Jenny, Aug 4, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    9,473
    vMike
    Aug 4, 2003
  2. Ryan Hartman

    large files via Response.OutputStream.Write

    Ryan Hartman, Nov 4, 2003, in forum: ASP .Net
    Replies:
    6
    Views:
    7,341
    Ryan Hartman
    Nov 11, 2003
  3. André
    Replies:
    3
    Views:
    1,924
    André
    Dec 1, 2006
  4. Replies:
    2
    Views:
    3,645
  5. Chris  Ashley
    Replies:
    0
    Views:
    431
    Chris Ashley
    Dec 5, 2007
Loading...

Share This Page