G
Guest
Hello All,
I am writing a web application that reads a bitmap from a file and outputing
it to a HTTP response stream to return the image to the requesting client.
The image file is a regular bitmap file (filename.bmp)
I am experiencing some difficulties with writing a bitmap to a http response
stream.
I load the bitmap from a file. and i use the following snippet of code to
write to HTTP response stream
Bitmap bmp;
//...load bmp with bitmap data from file
Response.ContentType = "image/bmp";
bmp.Save (Response.OutputStream, ImageFormat.Bmp);
After this code is called, I get an Exception message, "A generic error
occurred in GDI+.".
I know that the bitmap is ok since I am able to save it back to file again
with:
bmp.Save("somefilename.bmp",ImageFormat.Bmp);
Would anyone be able to shed some light with this problem.
Thanks
I am writing a web application that reads a bitmap from a file and outputing
it to a HTTP response stream to return the image to the requesting client.
The image file is a regular bitmap file (filename.bmp)
I am experiencing some difficulties with writing a bitmap to a http response
stream.
I load the bitmap from a file. and i use the following snippet of code to
write to HTTP response stream
Bitmap bmp;
//...load bmp with bitmap data from file
Response.ContentType = "image/bmp";
bmp.Save (Response.OutputStream, ImageFormat.Bmp);
After this code is called, I get an Exception message, "A generic error
occurred in GDI+.".
I know that the bitmap is ok since I am able to save it back to file again
with:
bmp.Save("somefilename.bmp",ImageFormat.Bmp);
Would anyone be able to shed some light with this problem.
Thanks