Image Streaming

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dolfandon
    New Member
    • Jan 2010
    • 1

    Image Streaming

    I have a silverlight application that is displaying images that are streamed from a server via an ASPX page. Previously this application was a Java applet. The page that streams the images used to set a mime type of gif. Since Silverlight doesn't handle gif's I switched it to png. This seems to work fine when being served from a Windows 7 development machine but when deployed to the Windows 2003 server I am receiving an error.

    A generic error occurred in GDI+.

    I am at a complete loss as to why this would happen. Any insight would be greatly appreciated. Here is the streamer code that is pretty straight forward. It is in the page load.

    Code:
                int imageId = Convert.ToInt32(Request.QueryString["Id"]);
                MemoryStream stream = new MemoryStream();
                try
                {
                    TaskDataProvider controller = new TaskDataProvider(WebServicesUri, TicketIdentity.Current.Ticket);
                    byte[] image = controller.GetTaskImage(imageId);
                    stream.Write(image, 0, image.Length);
                    Bitmap bitmap = new Bitmap(stream);
                    Response.ContentType = "image/png";
    [B]                bitmap.Save(Response.OutputStream, ImageFormat.Png);
    [/B]            }
                finally
                {
                    stream.Close();
                }
    TIA

    Don
    Last edited by Frinavale; Jan 19 '10, 04:11 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
Working...