Writing a file to output using Response.BinaryWrite?

Discussion in 'ASP .Net' started by Chris Ashley, Oct 2, 2007.

  1. Chris  Ashley

    Chris Ashley Guest

    I have a stream of bytes (making up a large file) coming from
    somewhere, and need to send it to the user. I can't send it to
    Response.OutputStream because this is read only, and storing the
    entire file in memory and then outputting that isn't really an option
    as the files are in excess of 200mb each. I am considering having a
    loop, and reading the stream and creating a buffer byte array every
    100kb or so, and then using Response.BinaryWrite to send this to the
    user - will this work if I set buffer to false and set the headers/
    contenttype correctly (IE: User gets file download box, and as they
    download my loop runs sending the bytes through), or will the user
    just see junk?
     
    Chris Ashley, Oct 2, 2007
    #1
    1. Advertising

  2. Chris  Ashley

    bruce barker Guest

    your approach is correct.

    -- bruce (sqlwork.com)



    Chris Ashley wrote:
    > I have a stream of bytes (making up a large file) coming from
    > somewhere, and need to send it to the user. I can't send it to
    > Response.OutputStream because this is read only, and storing the
    > entire file in memory and then outputting that isn't really an option
    > as the files are in excess of 200mb each. I am considering having a
    > loop, and reading the stream and creating a buffer byte array every
    > 100kb or so, and then using Response.BinaryWrite to send this to the
    > user - will this work if I set buffer to false and set the headers/
    > contenttype correctly (IE: User gets file download box, and as they
    > download my loop runs sending the bytes through), or will the user
    > just see junk?
    >
     
    bruce barker, Oct 2, 2007
    #2
    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. Charlie@CBFC
    Replies:
    1
    Views:
    2,864
    Arlyn
    May 13, 2005
  2. csgraham74
    Replies:
    0
    Views:
    812
    csgraham74
    Jun 9, 2005
  3. Replies:
    1
    Views:
    863
  4. MichiMichi
    Replies:
    1
    Views:
    804
    MichiMichi
    Mar 1, 2007
  5. S N
    Replies:
    0
    Views:
    254
Loading...

Share This Page