Copy Word files between web locations.

J

JohnSouth

Hi

I've a C# application that needs to copy files between remote web
locations (http:// or https://)

I can copy XML files using WebRequest/WebResponse OK, but Word
documents do not arrive as valid documents. The problem seems to be in
ascii encoding.
My question is can I use WebRequest/WebResponse to copy binary files?
Is there a better way to copy these files?

Cheers

John South
www.WhereCanWeGo.com
 
T

Tasos Vogiatzoglou

John,

If you want to transfer binary files (such Word documents, mp3, zip)
you have to encode them with BASE64 and submit them via HTTP.

Read the file with a BinaryReader and then use Convert.ToBase64String
passing the byte array. You can then transport it via WebRequest.

At the reception point use Convert.FromBase64String and get the byte
array where you can write it to the disk.

Regards,
Tasos
 

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