转换成流字节,输出浏览器下载

//转换成流字节,输出浏览器下载
var byti = file.SaveToStream().GetBuffer();
////通知浏览器保存文件,其实也就是输出到浏览器
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);
Response.BinaryWrite(byti);
Response.Flush();
Response.Close();

posted @ 2017-01-03 10:50  microsoftzhcn  阅读(1271)  评论(0编辑  收藏  举报