首页 > 其他 > 详细

ashx byte[]下载

时间:2020-02-27 10:59:41      阅读:64      评论:0      收藏:0      [点我收藏+]

html部分<a href="ashx?参数">

ashx部分

public override void ProcessRequest(HttpContext context)
{
this.UserID = base.BaseUserID;
this.strAttachGuid = context.Request["AttachGuid"];
byte[] bytes = Download(context);

if (bytes != null)
{
context.Response.Buffer = true;
context.Response.Clear();
context.Response.ContentType = "application/download";
context.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(strFileName, System.Text.Encoding.UTF8));
context.Response.BinaryWrite(bytes);
context.Response.Flush();
context.Response.Clear();
context.Response.End();
}
}

ashx byte[]下载

原文:https://www.cnblogs.com/chengeng/p/12370684.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!