On Tuesday, November 26, 2002 at 09:03, Van Der Westhuizen, Sonja wrote:
SVDW> I've got the following vb.net code to retreive the dilbert image, display it
SVDW> on the webpage and writing it to hd. Everything seems to be working fine
SVDW> except when I try to write the binary stream to the harddrive. I create the
SVDW> name in the correct directory (and the size is 31k, so it is writing the
SVDW> info) but when I try opening up the gif file it doesnt' display. Either no
SVDW> preview is available or there's just an ie X where the picture should be.
SVDW> Please help. I have no idea what to search for to fix it :(.... Here's the
SVDW> code...
i *think* what's happening is you are writing the stream out correctly,
but as a binary stream, not as an image so when you come to open it, the
system doesn't handle it properly.
anyway i think the following would work...this is untested, so don't
blame me if the machine dies a painful death! ;>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
' Declare variables
Dim oDly As New com.esynaps.www.DailyDilbert()
Dim oByte() As Byte
' This is the call to the web service
oByte = oDly.DailyDilbertImage()
'display it on website
Response.BinaryWrite(oByte)
'save gif to hd
dim strmMem as MemoryStream = new MemoryStream(oByte)
dim dilbertPic as Image = new Bitmap(strmMem)
dilbertPic.Save("c:\temp\dailydilbert.gif")
strmMem.Close()
End Sub
make sure that the asp.net process has permission to write to the
directory as well.
hope that works,
darren
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]