C#下载代码,防迅雷
2009-03-15 13:00
239 查看
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#下载代码,防迅雷
- C# 从服务器下载文件代码
- Asp.net 2.0 C#实现压缩/解压功能 (示例代码下载)
- ASP.NET(C#)下载图片代码
- Asp.net 2.0 用C# 创建 PDF文件[引用] (示例代码下载)
- 【荐】matlab、C++、C#学习及代码下载推荐网站
- C# 从服务器下载文件代码
- C#下载文件代码更新20070920
- C# 从服务器下载文件代码
- 使用VS2010 C#开发ActiveX控件(下),完整代码下载
- 《C#和.NET实战:平台、语言与框架》-配套代码下载
- 文件下载代码,可以用迅雷进行下载(因为之前用过一段下载文件的代码,但是不能用迅雷下载,超级汗!!!)
- 使用VS2010 C#开发ActiveX控件(下),完整代码打包下载
- 开源!开源!我写的Anto.exe C#代码自动生成工具.欢迎下载。。
- C# 简单的从服务器下载文件代码
- Asp.net 2.0 C#实现压缩/解压功能 (示例代码下载)
- 发布EntLib.com / YAF 开源论坛 V3.0 (ASP.NET/C#) -- 提供代码下载!
- EntLib.com / YAF 开源论坛 V3.0 (ASP.NET/C#) -- 提供代码下载!