ashx 下载文件

ashx后台

byte[] file =GetFileByte("");

Response.ContentType = "application/octet-stream";

Response.AppendHeader("Content-Disposition", "attachment;Filename=123.pdf");

Response.BinaryWrite(file);

Response.Flush();

Response.End();

js:

var newUrl = "1111.ashx?Action=LoadByID&ID=" + id;
location.href = newUrl;

posted @ 2015-10-08 14:31  msikruby  阅读(442)  评论(0编辑  收藏  举报