asp.net点击按钮下载图片而不是打开图片

来源:互联网 发布:通达信sar指标源码 编辑:程序博客网 时间:2024/05/17 23:02
//下载图片
Response.ContentType = "application/x-msdownload";
string filename = "attachment; filename=" + "123.jpg";
Response.AddHeader("Content-Disposition", filename);
string filepath = "/images/123.jpg";
Response.TransmitFile(Server.MapPath(filepath));
原创粉丝点击