private void writeFile(MyFile myfile, int statusCode = 200) { writeHeader(statusCode, myfile.GetContentType(), myfile.GetLength()); byte[] buffer = new byte[1024]; while (myfile.Read(buffer, buffer.Length) > 0) { write(buffer); } myfile.Close(); }