Issues while encoding

G

Guest

hello all,

I am using vb.net to read a image file and then tryied to convert it to a
string using the following code

Dim fs As FileStream = New FileStream(filename,
FileMode.OpenOrCreate, FileAccess.Read)
Dim rawData() As Byte = New Byte(fs.Length) {}
fs.Read(rawData, 0, System.Convert.ToInt32(fs.Length))
fs.Close()

dim filedata as string
filedata=System.Text.ASCIIEncoding.ASCII.GetString(rawData)

Upto this point it get converted into string

Now I am passing this string to some web service where i want to get the
image back from this string

I write my code like this

Dim bw As BinaryWriter
Dim outbuff() As Byte
outbuff =
System.Text.ASCIIEncoding.ASCII.GetBytes(filedata )
fs = New FileStream("C:\" & nodeattrib.Value,
FileMode.Create, FileAccess.Write)
fs.Write(outbuff, 0, outbuff.Length)

File is created in the path specified but, i cannot open it.

Can Anyone help me out in this case.

It is very urgent

Thanks in advance
 

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

Top