你好,欢迎来到电脑编程技巧与维护杂志社! 杂志社简介广告服务读者反馈编程社区  
合订本订阅
 
 
您的位置:技术专栏 / Linux开发
C#实现大文件分块发送到客户端(3)
 
It should be noted that in IE 4-6 and Netscape 4.7-7.0 on the PC, Netscape
4.7 on Mac OS 9, and IE 5 on Mac OS 10 all work perfectly with the memory
consumption during the download taking no more than 1 MB of RAM which is
released after the download completes.

Does anyone have any suggestions on how I can force the memory to be
released after the download?  Or any information on what is actually
causing the memory utilization in this one case?

Thank you,


Here is the source code for the stream file function:


        private void StreamFile(string SourceFilepath, string
OutputFilename)
        {
            System.IO.Stream iStream = null;

            // Buffer to read 10K bytes in chunk:
            byte[] buffer = new Byte[10000];

            // Length of the file:
            int length;

            // Total bytes to read:
            long dataToRead;

            try
            {
                // Open the file.
                iStream = new System.IO.FileStream(SourceFilepath,
System.IO.FileMode.Open);

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

                Response.ContentType = "application/octet-stream";
                Response.AddHeader("Content-Disposition", "attachment;
filename=" + OutputFilename);
                Response.AddHeader("Content-Length", dataToRead.ToString
());
(编辑:aniston)

  推荐精品文章

·2024年12月目录 
·2024年11月目录 
·2024年10月目录 
·2024年9月目录 
·2024年8月目录 
·2024年7月目录 
·2024年6月目录 
·2024年5月目录 
·2024年4月目录 
·2024年3月目录 
·2024年2月目录 
·2024年1月目录
·2023年12月目录
·2023年11月目录

  联系方式
TEL:010-82561037
Fax: 010-82561614
QQ: 100164630
Mail:gaojian@comprg.com.cn

  友情链接
 
Copyright 2001-2010, www.comprg.com.cn, All Rights Reserved
京ICP备14022230号-1,电话/传真:010-82561037 82561614 ,Mail:gaojian@comprg.com.cn
地址:北京市海淀区远大路20号宝蓝大厦E座704,邮编:100089