0%

ashx输出图片

1
2
3
4
5
6
7
context.Response.ContentType = "text/plain";
//context.Response.Write("二维码:1000元");
string path = context.Server.MapPath("../Images/ShouKuan.png");
//获取图片文件的二进制数据。
byte[] datas = System.IO.File.ReadAllBytes(path);
//将二进制数据写入到输出流中。
context.Response.OutputStream.Write(datas, 0, datas.Length);