FtpWebRequest

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I'm using FtpWebRequest to send a encrypted pgp file. It sends the file but
molestes the data in the process. I think it's happening in the line

byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());

I want to sent the file as is and not make any changes to the bits. Which
encoding should I use.

By the way I have request.UseBinary = true;

Thanks,
 
Dave said:
I'm using FtpWebRequest to send a encrypted pgp file. It sends the file but
molestes the data in the process. I think it's happening in the line

byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());

I want to sent the file as is and not make any changes to the bits. Which
encoding should I use.

None. Just send the bytes.

Pete
 
I'm using FtpWebRequest to send a encrypted pgp file. It sends the file but
molestes the data in the process. I think it's happening in the line

byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());

I want to sent the file as is and not make any changes to the bits. Which
encoding should I use.

By the way I have request.UseBinary = true;

If it is indeed a binary files, then you should read it
as byte[] with Stream Read and not as String with
StreamReader ReadToEnd.

Most likely the corruption is happening due to the
byte[] -> String -> byte[] you do.

Arne
 
Back
Top