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

//下载图片
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));

你可能感兴趣的:(asp.net)