Response.WriteFile seems to be adding an extra byte

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: David Union (d.union_at_verizon.net)
Date: 09/01/04


Date: Wed, 1 Sep 2004 18:02:15 -0400

I am doing very simple code...
in the middle of an http request, i set a filename (with path)
and do a Response.WriteFile(filenamewithpath)
then Response.End().

I have tried Response.Clear() and .Flush() ahead of time.

I have tried various permutations (all, I think) of Content-Type
and Content-Disposition.

I have also tried opening a file stream and copying the data
to an array of bytes (the data is good in the array) and then
doing a Response.BinaryWrite(binaryarray)
then Response.End().

I've also tried Response.Close().

In all cases I get an extra byte at the end of the file,
so the CRC doesn't match up.

Anyone know the solution for this?

Windows 2000 Server, Visual Studio 2003
with the appropriate and updated framework.

This is in Visual Basic in the code-behind page.

Thanks,
DU



Relevant Pages

  • Response.WriteFile() giving an extra byte at the end?
    ... This is for an aspx page with Visual Basic as the code-behind page. ... I have tried various permutations of Content-Type ... I have also tried opening a file stream and copying the data ... to an array of bytes and then ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Response.WriteFile seems to be adding an extra byte
    ... > in the middle of an http request, i set a filename ... > I have tried various permutations of Content-Type ... > I have also tried opening a file stream and copying the data ... > to an array of bytes and then ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How to dump the value of all variables when an exception was raised, and reload them to repeat t
    ... with Visual Studio 2005 standard edition. ... I don't know anything about the Intel compiler or your version of Visual Studio. ... See what happens when you turn on options to check array bounds and uninitialized variables. ... Better yet, modify the file name so that if you do ten of these checkpoints, you'll have ten files with names corresponding to the checkpoint number. ...
    (comp.lang.fortran)
  • Re: reading after xmlHTTP.responseText ?
    ... Not sure you can treat the HTTP response in the same way as a file stream. ... Try creating an array of lines using Splitand then looping through the ... dim arrLines ...
    (microsoft.public.scripting.vbscript)
  • Re: Text or character find in TFileStream
    ... Tomaz Koritnik wrote in article ... Just read block by block (a block is array of char for example) ... > file stream using TFileStream.Readand scan each block for characters. ...
    (borland.public.delphi.non-technical)