码迷,mamicode.com
首页 > Web开发 > 详细

Asp.net文件下载

时间:2016-06-14 10:15:10      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

string path = @"F:\me\Smile\1\Web\image\1.jpg";
            string name = "1.jpg";
            FileInfo Downloadfile = new FileInfo(path);
            Response.Clear();
            Response.ClearHeaders();
            Response.Buffer = false;
            Response.ContentType = "application/octet-strearm";
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(name, System.Text.Encoding.UTF8));
            Response.AppendHeader("Content-Length", Downloadfile.Length.ToString());
            Response.WriteFile(Downloadfile.FullName);
            Response.Flush();
            Response.End();

 using System.IO;

Asp.net文件下载

标签:

原文地址:http://www.cnblogs.com/jingyong001/p/5582881.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!