ASP.NET中无法通过编程方式实现多线程断点续传
2007-11-09 00:11
513 查看
以前一直错误的认为在ASP.NET中无法通过编程方式实现多线程断点续传,今天终于获得了这样一个解决方案,让我明白要学习的东西还很多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();方法。
// 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();方法。
相关文章推荐
- 在 ASP.NET 网页中不经过回发而以编程方式实现客户端回调
- 如何通过js跨域调用ASP.NET Web API (请问如何实现在javascript中通过http get的方式跨域调用ASP.NET Web API?)
- 在 ASP.NET 网页中不经过回发而以编程方式实现客户端回调
- 在 ASP.NET 网页中不经过回发而以编程方式实现客户端回调
- Asp.net中编程方式调用ashx(通过webRequest)
- ASP.NET MVC下的四种验证编程方式[续篇]【转】
- ASP.NET中通过文本框的输入实现"拼音码"动态查询的效果
- ASP.NET - 如何:以编程方式测试 ASP.NET 服务器控件的有效性
- 介绍ASP.NET 与 Ajax 的实现方式
- ASP.NET MVC资源文件多语言实现方式
- asp.net通过反射技术实现Ajax(3)--第一个简单的例子
- ASP.NET MVC的四种验证编程方式
- ASP.NET MVC的四种验证编程方式
- iOS开发之iPhone通过get和post方式请求asp.net webservice
- Asp.net(c#)实现多线程断点续传
- ASP.NET通过回答提示问题以邮件方式找回密码
- 通过Docker Compose及NGINX反向代理实现ASP.NET5应用的负载均衡
- 通过扩展改善ASP.NET MVC的验证机制[实现篇]
- ASP.NET MVC下的四种验证编程方式
- Asp.net(c#)实现多线程断点续传