Display Image Binary data in Web Browser

K

klj_mcsd

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
 
K

Keenan Newton

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

Pete Wood

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!
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top