Insert inline image -> without another aspx page in src

Discussion in 'ASP .Net' started by jenp, Nov 20, 2006.

  1. jenp

    jenp Guest

    Hello

    I've got a rather tricky problem here - i'm looking to insert a graph
    into a web page - which is represented as a jpeg image.

    Due to the restrictions of the framework i'm developing against, the
    data for the graph is only stored in the HTTPContext's Items
    collection, so the page that displays the graph is the only one with
    the data.

    This means I can't simply reference another aspx page in the src tag of
    the image

    <img src="graphImage.aspx"/> <!-- No good -->

    I've also tried to call a method to do a Reponse.BinaryWrite of the
    image's binary data - but this doesn't work either, as the Response
    object becomes confused with multiple content types.

    <img src='<%GetGraphData();%>'/> <!-- Spits out random ASCII chars -->

    Is there any way that I can spoof a complete HTTPResponse from within a
    method in the code behind page, so the browser thinks it is pointing to
    a separate page in the src tag? Something along the lines of creating a
    new Response object I assume, although any pointers would be very
    useful...

    Many thanks

    Phil
     
    jenp, Nov 20, 2006
    #1
    1. Advertisements

  2. jenp

    Guest Guest

    This is possible but IE doesnt support inline images. The best this to do
    would be to take it from the context yourself and save it to a folder on the
    web server. Then use that as the image source. You could cache where you
    saved it and remove it later, or remove it on Session_End.

    Ciaran O'Donnell
     
    Guest, Nov 20, 2006
    #2
    1. Advertisements

  3. jenp

    Pancho Guest

    i think you can solve your problem using httphandlers....

    this solution requires a customized configuration in the IIS...but it
    solve the problem of getting an image that has no path in the web
    server.

    Regards.

    Francisco.
     
    Pancho, Nov 20, 2006
    #3
  4. jenp

    Pancho Guest

    Pancho, Nov 20, 2006
    #4
    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.