Display Image Binary data in Web Browser

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default Display Image Binary data in Web Browser

    I'm returning the binary data from my webservice and it works but I'm
    having problems rendering the image in an <img> tag in my web browser.
    The code I'm using is below:


    Dim wsurl
    wsurl = "http://localhost/wsImage/wsImage.asmx/GetImage?sSpecNo=" & "1"
    Dim xmlhttp
    Set xmlhttp=Server.CreateObject("MSXML2.ServerXMLHTTP" )xmlhttp.open
    "GET",wsurl,false
    xmlhttp.send
    Response.ContentType = "image/png"
    Response.BinaryWrite xmlhttp.responsebody
    Set xmlhttp=nothing
    Response.End

    I am calling this code from my image tag

    klj_mcsd@hotmail.com Guest

  2. Similar Questions and Discussions

    1. Display BInary TIF file from database?
      Is there a way to pull a TIFF binary field from a database and display it in a cold fusion page? I have it working part time with an ASP page and a...
    2. encrypting data in PHP and then display it unencrypted back to the browser
      I want to store some information in mySQL and want to encrypt it so that it isnt easily read by anyone else. But then I want to be able to deencrypt...
    3. How to convert JPEG image into a binary data?
      Hi, Using ASP and VBScript. How to convert JPEG image into a binary data? Is it possible with a command from ASP / VBScript without having to put...
    4. I need to display a PDF from SQL Binary Field
      I am trying to display a PDF from SQL. All I am getting is garbage that looks like this: %PDF-1.3 %âãÏÓ 37 0 obj << /Linearized 1 /O 39 /H /L...
    5. Secure binary files with ASP.NET and open PDF with Browser
      Open Binary files with ASP.Net Posted: 07-08-2003 05:47 PM I am trying to protect PDF files with a form that asks the user to enter name and...
  3. #2

    Default Re: Display Image Binary data in Web Browser

    One way to do is is mage the img src point to an ASPX page that outouts
    the binary. Does this answer your question?

    Keenan Newton Guest

  4. #3

    Default Re: Display Image Binary data in Web Browser

    Yes its a problem. You can construct an ASPX page with a graphic <IMG> with
    src= "/images/mydownload.jpg". You can then write the binary data to the
    exact same file location, and over-ride the "dummy" file that was there
    already. I have an example somewhere, so let me know if this isn't clear
    and I'll dig it out for you - it may take a while!
    --
    Pete Wood
    Contact me at [url]http://www.webserviceshelp.org[/url] for more help
    __________________________________________________ _______


    <klj_mcsd@hotmail.com> wrote in message
    news:1121109118.316348.196630@g47g2000cwa.googlegr oups.com...
    > I'm returning the binary data from my webservice and it works but I'm
    > having problems rendering the image in an <img> tag in my web browser.
    > The code I'm using is below:
    >
    >
    > Dim wsurl
    > wsurl = "http://localhost/wsImage/wsImage.asmx/GetImage?sSpecNo=" & "1"
    > Dim xmlhttp
    > Set xmlhttp=Server.CreateObject("MSXML2.ServerXMLHTTP" )xmlhttp.open
    > "GET",wsurl,false
    > xmlhttp.send
    > Response.ContentType = "image/png"
    > Response.BinaryWrite xmlhttp.responsebody
    > Set xmlhttp=nothing
    > Response.End
    >
    > I am calling this code from my image tag
    >

    Pete Wood Guest

  5. #4

    Default Re: Display Image Binary data in Web Browser

    Quote Originally Posted by Keenan Newton View Post
    One way to do is is mage the img src point to an ASPX page that outouts
    the binary. Does this answer your question?
    can u explain me in detail
    heerasharma007 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139