您的位置:首页 > 编程语言 > ASP

Asp.net(c#)实现多线程断点续传

2008-03-06 10:57 357 查看
System.IO.Stream iStream = null;

// Buffer to read 10K bytes in chunk:

byte[] buffer = new Byte[10240];

// Length of the file:

int length;

// Total bytes to read:

long dataToRead;

// Identify the file to download including its path.

string filepath = @"E:\software\SQL Server 2000 Personal Edition.ISO";

// Identify the file name.

string filename = System.IO.Path.GetFileName(filepath);

try

catch (Exception ex)

finally

{

if (iStream != null)

{

//Close the file.

iStream.Close();

}

Response.End();

}

本解决方案所参考的资料链接列表(在此对作者表示感谢):

http://blog.csdn.net/playyuer/archive/2004/08/02/58430.aspx

http://www.httpsniffer.com/http/1416.htm

http://support.microsoft.com/default.aspx?scid=kb;en-us;812406&Product=aspnet

更新:

此解决方案已根据playyuer 提出的问题作了更新,另外在输出前调用了Response.Clear();方法。

原文出处:http://www.cnblogs.com/bestcomy/archive/2004/08/10/31950.aspx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: