Reputation: 9926
When i using the HttpWebRequest - i need to send byte[] ( as far as i know ) So i doing it in this code
_argRequest[] = ....
using( Stream reqStream = _httpWebRequest.GetRequestStream() )
{
if( _argRequest != null )
{
reqStream.Write( _argRequest, 0, _argRequest.Length );
reqStream.Flush();
reqStream.Close();
}
}
But is it possible to send Stream and not byte[] - ( without casting the Stream to byte[] )
Thanks
Upvotes: 1
Views: 114
Reputation: 100527
Stream.CopyTo can copy stream without (externally visible) usage of byte[]
:
streamToPost.CopyTo(reqStream);
Upvotes: 2