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));
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章