WORKING

*smooch* *smooch* *smooch*

ur a star :>

thanx
s
:)
-----Original Message-----
From: darren [mailto:[EMAIL PROTECTED]]
Sent: 26 November 2002 03:20 PM
To: [EMAIL PROTECTED]
Subject: [wdvltalk] Re: [ot] how to write a binary stream


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.unsub%%

___________________________________________________________________________________________________


The views expressed in this email are, unless otherwise stated, those of the author 
and not those
of the FirstRand Banking Group or its management.  The information in this e-mail is 
confidential
and is intended solely for the addressee. Access to this e-mail by anyone else is 
unauthorised. 
If you are not the intended recipient, any disclosure, copying, distribution or any 
action taken or 
omitted in reliance on this, is prohibited and may be unlawful.
Whilst all reasonable steps are taken to ensure the accuracy and integrity of 
information and data 
transmitted electronically and to preserve the confidentiality thereof, no liability 
or 
responsibility whatsoever is accepted if information or data is, for whatever reason, 
corrupted 
or does not reach its intended destination.

                               ________________________________

____ � 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]

Reply via email to