Steaming Images to Web browser

G

Guest

Can someone enlighten me on why I am being prompted to down load the
following file and why the file is not displaying my images? The images are
being streamed from an Array retreived from Active Directory...

//NEW CODE for displaying IMAGE from MEMORY
MemoryStream myStream; Byte[] imgByte =
(Byte[])myCollection; myStream = new MemoryStream(imgByte);

System.Drawing.Image _image =
System.Drawing.Image.FromStream(myStream);
System.Drawing.Image _newimage =
_image.GetThumbnailImage(50, 50, null, new System.IntPtr());
Response.ContentType = "image/jpg";
_newimage.Save(Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Jpeg);


When I am prompted to say I recieve garbage from the streaming image.
 
O

Octavio Hernandez

Hi,

A few ideas:
a) Try using Response.Clear() before the call to _newimage.Save()
b) Try saving the image to a temp file and then using Response.WriteFile()
c) Try using Response.End() after the call to _newimage.Save()

Regards -Octavio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top