A
Alex Nitulescu
Hi. I have a WebService which provides a webmethod which returns a byte
array representing a picture. The method's signature is:
<WebMethod(Description:="Shows something nice every time !")> Public
Function GetRandomImage() As Byte()
I then have a test application (with a web reference to my web service)
which has the following code:
Public Class BinaryWebServiceTest
Inherits System.Web.UI.Page
Protected WithEvents lblResults As System.Web.UI.WebControls.Label
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim objBinaryWebService As New localhost.ImagesWebService()
Response.Clear()
Response.ClearHeaders()
Response.ContentType = "image/jpeg"
Response.BinaryWrite(objBinaryWebService.GetRandomImage)
objBinaryWebService.Dispose()
End Sub
End Class
That's all, and it works fine, except.... I have controls on my test form. I
also have set a bgColor of my page, a custom header, footer, and so on.
However, when I call "response.BinaryWrite" they all vanish (or is it
because of "Response.ContentType" ???) - the random pictures I'm showing
look just fine, but I need to paint them differently, so as to be able to
see the rest of the contents of my page. What are my options, please ?
Thank you, Alex.
PS. Yes, I *could* use a Image control and in the web service manufacture a
random NavigateURL from my "Pictures" directory, but what If I need to
transmit images instead of links ?
array representing a picture. The method's signature is:
<WebMethod(Description:="Shows something nice every time !")> Public
Function GetRandomImage() As Byte()
I then have a test application (with a web reference to my web service)
which has the following code:
Public Class BinaryWebServiceTest
Inherits System.Web.UI.Page
Protected WithEvents lblResults As System.Web.UI.WebControls.Label
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim objBinaryWebService As New localhost.ImagesWebService()
Response.Clear()
Response.ClearHeaders()
Response.ContentType = "image/jpeg"
Response.BinaryWrite(objBinaryWebService.GetRandomImage)
objBinaryWebService.Dispose()
End Sub
End Class
That's all, and it works fine, except.... I have controls on my test form. I
also have set a bgColor of my page, a custom header, footer, and so on.
However, when I call "response.BinaryWrite" they all vanish (or is it
because of "Response.ContentType" ???) - the random pictures I'm showing
look just fine, but I need to paint them differently, so as to be able to
see the rest of the contents of my page. What are my options, please ?
Thank you, Alex.
PS. Yes, I *could* use a Image control and in the web service manufacture a
random NavigateURL from my "Pictures" directory, but what If I need to
transmit images instead of links ?