background image

§                Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.

HttpUtility.UrlEncode(Request.ContentEncoding.GetBytes(filename)));

§

§                iStream.Position = p;

§                dataToRead = dataToRead - p;

§                

// Read the bytes.

§

                

while

 (dataToRead > 0)

§§                {

§                    

// Verify that the client is connected.

§

                    

if

 (Response.IsClientConnected) 

§§                    {

§                        

// Read the data in buffer.

§

                        length = iStream.Read(buffer, 0, 10240);

§

§                        

// Write the data to the current output stream.

§

                        Response.OutputStream.Write(buffer, 0, length);

§

§                        

// Flush the data to the HTML output.

§

                        Response.Flush();

§

§                        buffer= 

new

 Byte[10240];

§                        dataToRead = dataToRead - length;