.NETte Dinge und noch einiges mehr ;-) RSS 2.0
 Monday, January 22, 2007
Verflixt und zu genäht, dachte ich mir, weil folgende Zeilen nicht funktionierten:

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 :-)

Monday, January 22, 2007 10:58:46 PM (W. Europe Standard Time, UTC+01:00)  #    Comments [0] -
ASP.NET
Comments are closed.
Archive
<January 2009>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2009
Christian Stein
Sign In
Statistics
Total Posts: 238
This Year: 0
This Month: 0
This Week: 0
Comments: 20
All Content © 2009, Christian Stein
DasBlog theme 'Business' created by Christoph De Baene (delarou)