// http://support.microsoft.com/kb/812406/en-us/
        private static void streamFileToBrowser(
            HttpResponse response,
            FileInfo file,
            string fileName)
        {
            Stream iStream = null;

            try
            {
                // Open the file.
                iStream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);

                // Total bytes to read:
                var dataToRead = iStream.Length;

                response.Cache.SetExpires(DateTime.Now - TimeSpan.FromDays(1000));

                response.ContentType = MimeHelper.MapFileExtensionToMimeType(file.Extension); //@"application/octet-stream";
                response.AddHeader(@"Content-Disposition", @"attachment; filename=" + fileName);
                response.AddHeader(
                    @"Content-Length",
                    string.Format(
                        @"{0}",
                        file.Length));

                // Read the bytes.
                while (dataToRead > 0)
                {
                    // Verify that the client is connected.
                    if (response.IsClientConnected)
                    {
                        // Read the data in buffer.
                        var buffer = new byte[10000];
                        var length = iStream.Read(buffer, 0, 10000);

                        // Write the data to the current output stream.
                        response.OutputStream.Write(buffer, 0, length);

                        // Flush the data to the HTML output.
                        response.Flush();

                        dataToRead = dataToRead - length;
                    }
                    else
                    {
                        //prevent infinite loop if user disconnects
                        dataToRead = -1;
                    }
                }
            }
            finally
            {
                if (iStream != null)
                {
                    iStream.Close();
                    iStream.Dispose();
                }
                response.Close();
            }
        }