C#下载代码,防迅雷
2010-06-29 13:18
267 查看
protected void btn_Download_Click(object sender, EventArgs e)
{
string strFileUploadPath = "Files/";
//从列表框控件中读取选择的文件名
string strFileName = lb_FileList.SelectedValue; //组合成物理路径
string strFilePhysicalPath = Server.MapPath("~/" + strFileUploadPath + strFileName);
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;FileName=" + HttpUtility.UrlEncode(strFileName, System.Text.Encoding.UTF8));
Response.WriteFile(strFilePhysicalPath);
Response.End();
}
{
string strFileUploadPath = "Files/";
//从列表框控件中读取选择的文件名
string strFileName = lb_FileList.SelectedValue; //组合成物理路径
string strFilePhysicalPath = Server.MapPath("~/" + strFileUploadPath + strFileName);
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;FileName=" + HttpUtility.UrlEncode(strFileName, System.Text.Encoding.UTF8));
Response.WriteFile(strFilePhysicalPath);
Response.End();
}
相关文章推荐
- C#下载代码,防迅雷
- Asp.net 2.0 用C# 创建 PDF文件[引用] (示例代码下载)
- ASP.NET(C#)下载图片代码
- Asp.net 2.0 C#实现压缩/解压功能 (示例代码下载)
- C# 从服务器下载文件代码
- C#调用迅雷下载
- C#下载文件代码更新20070920
- C# 从服务器下载文件代码
- 使用VS2010 C#开发ActiveX控件(下),完整代码下载
- C# 从服务器下载文件代码
- 《C#和.NET实战:平台、语言与框架》-配套代码下载
- 使用VS2010 C#开发ActiveX控件(下),完整代码打包下载
- C# 简单的从服务器下载文件代码
- 开源!开源!我写的Anto.exe C#代码自动生成工具.欢迎下载。。
- Asp.net 2.0 C#实现压缩/解压功能 (示例代码下载)
- 发布EntLib.com / YAF 开源论坛 V3.0 (ASP.NET/C#) -- 提供代码下载!
- 新灵感站族管理系统 API接口 (ASP.NET C#)示例下载及代码说明