保存网页上的图片到本地

protected void Button1_Click(object sender, EventArgs e) {
string url = Server.MapPath("/img/image.png");
FileInfo file = new FileInfo(url);
Response.ContentType = "image/png";
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode("优惠券.png", System.Text.Encoding.UTF8));
Response.WriteFile(url);
Response.Flush();
}

原文地址:https://www.cnblogs.com/ZkbFighting/p/8603646.html