當我使用Handler.ashx ans顯示文件夾中的圖像時,然後嘗試通過右鍵單擊保存圖像,它不斷給我選擇「另存爲類型」asp.net通用處理程序和處理程序名稱作爲文件名。 。上述另存爲通用handler.ashx中的提示「圖像名稱」?
Bitmap target = new Bitmap(width, height);
using (Graphics graphics = Graphics.FromImage(target)) {
graphics.CompositingQuality = CompositingQuality.HighSpeed;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.DrawImage(photo, 0, 0, width, height);
using (MemoryStream memoryStream = new MemoryStream()) {
target.Save(memoryStream, ImageFormat.Png);
OutputCacheResponse(context, File.GetLastWriteTime(photoPath));
using (FileStream diskCacheStream = new FileStream(cachePath, FileMode.CreateNew))
{
memoryStream.WriteTo(diskCacheStream);
}
memoryStream.WriteTo(context.Response.OutputStream);
}
}
是處理程序和
ImageTiff.ImageUrl = "Handler.ashx?p=" + Parameter;
這是後面的代碼。
我需要將其與圖片名稱保存ANS不如handler.ashx
我已經試過了所有的兄弟,但是我得到了同樣的錯誤!!浪費了將近2個小時! –
@Fhd,但我沒有看到你發佈的任何地方 –
文件名應該用引號:'filename = \「yourfilename.png \」',否則Firefox可能會導致問題。至於使Rightclick =>保存目標爲工作 - 沒有機會這樣做。 –