public void ProcessRequest(HttpContext context) {Bitmap img = PrepareData();System.IO.MemoryStream tempStream = new System.IO.MemoryStream();img.Save(tempStream, System.Drawing.Imaging.ImageFormat.Png);img.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);}
Jedesmal gab es den Fehler "Allgemeiner Fehler in GDI+". Nur beim Verändern auf ImageFormat.Jpeg gab es ein Ergebnis. Hmm irgendwie komisch. Zumal das Image als Bild herausgeschrieben wunderbar aussah und mehrere Betrachter keinerlei Probleme damit hatten damit. Dann hab ich folgendes ausprobiert. Einfach mal den Stream in einem MemoryStream zwischenspeichern:
public void ProcessRequest(HttpContext context) {Bitmap img = PrepareData();System.IO.MemoryStream tempStream = new System.IO.MemoryStream();img.Save(tempStream, System.Drawing.Imaging.ImageFormat.Png);context.Response.BinaryWrite(tempStream.ToArray());context.Response.End();}
Und schon kam das gewünschte Ergebnis
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.