Problem with Dynamic Images in WebConrols

Discussion in 'ASP .Net Web Controls' started by Ali Khawaja, Apr 12, 2004.

  1. Ali Khawaja

    Ali Khawaja Guest

    I have trying to build a control: PieChartControl : System.Web.UI.WebControls.WebContro
    in which i am creating a dynamic image based on some data from database

    in the render method of the control, I set the content type of image/jpeg
    this.Context.Response.ContentType = "image/jpeg"
    and then once I am done with creating the image, I save it to the output stream
    bmp.Save(this.Context.Response.OutputStream, ImageFormat.Jpeg)

    I added it to the toolbar, and dropped on my test form, and its shows characters like its not recognizing the content type

    Can anyone please let me know what I am doing wrong

    I'll really appreciate any help
    Thank
    Al
     
    Ali Khawaja, Apr 12, 2004
    #1
    1. Advertisements

  2. You need to call this control from a page that has no content. Basically
    it's empty, no HTML or anything (even one space sent to the browser can mess
    this up). You then call this page as the source of an image tag. For example
    <img src="myimage.aspx"> where myimage.aspx has the control in it. You can't
    embed the binary data into the web page which is why you get the dump of
    characters.

    Hope this helps,
    Mark Fitzpatrick
    Microsoft MVP - FrontPage


    characters like its not recognizing the content type.
     
    Mark Fitzpatrick, Apr 13, 2004
    #2
    1. Advertisements

  3. Hi Ali,

    Does Mark's reply makes sense to you? Do you still have any concern?

    Please feel free to let me know, I will help you. Thanks

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
     
    Jeffrey Tan[MSFT], Apr 15, 2004
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.