asp.net 保存网页上的图片到本地

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();
        }

你可能感兴趣的:(图片,C#,asp.net)