C#下载代码,防迅雷
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();
??? }
?
轉載于:https://www.cnblogs.com/liufei88866/archive/2010/06/29/1767497.html
總結
以上是生活随笔為你收集整理的C#下载代码,防迅雷的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mac jdk安装配置环境变量
- 下一篇: s7.net 写数据到plc_三个C#读