If you write your data to a stream via the HttpWebRequest.GetRequestStream
, you will be sending pure binary data without any transformation to base64. You will have to parse the data on the receiving end as a binary stream.
As a side note, I would also always steer away from base64 when sending data across a network because it will increase your bandwidth to transfer the data. For every 3 bytes that you convert to base64 will come out 4. So you have a 33% overhead for all of your data.
EDIT: Going into a little more depth here for Hellfrost. The HttpWebRequest.GetRequestStream
allows you lower level access to the stream which in-turn allows you to send binary data over the connection. If you are trying to send the data to a web-server, I would suggest you looking into post-data and multipart/form-data
. You can read more about it here: Upload files with HTTPWebrequest (multipart/form-data)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…