Sending files to the client

Discussion in 'ASP .Net' started by Buddy Ackerman, May 9, 2005.

  1. I'm sending file to the client (see sample code below) but when I send a large file the user gets a document contains no
    data message.

    response.contenttype = "application/x-unknown"
    myheader = "attachment;"
    Response.AddHeader("Content-Disposition", myheader)
    Response.WriteFile(FileName, StartPos, FileSize)

    I'm dynamically creating the ZIP file (prior to the above code running but in the same page). It only takes about 10
    seconds to create the zip file.

    The file I'm having trouble with is 112MB. It takes about 15 - 20 second to create the file. The code itself does not
    create an error but the end user gets a message (from the browser) that says "the document contains no data", the
    messages comes up immediately after the code has completed (this is based on me seeing the last datbase instruction
    being sent which is immediately after the file creation is complete and right before the response.writefile instruction.

    I also tested the page by bypassing the code that creates the file and just had it try and send the file (since it
    already existed from the previous run) but I got the same message. Funny though, the message still took about 30 second
    to display.

    Also to make sure that the zip file was a valid zip, I opened it in WinZip (with no problems).

    Is there some kind of limit when sending files like this? Smller files seem to work fine, although I haven't determined
    the threshold for failure. Would it have anything to do with the amount of available RAM?

    Buddy Ackerman, May 9, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.