SocketTools .NET Edition

HttpClient.PostData Method (String, MemoryStream, MemoryStream)

Submits the contents of the specified MemoryStream to a resource on the server.

[Visual Basic]
Overloads Public Function PostData( _
   ByVal resourceName As String, _
   ByVal requestStream As MemoryStream, _
   ByVal responseStream As MemoryStream _
) As Boolean
[C#]
public bool PostData(
   string resourceName,
   MemoryStream requestStream,
   MemoryStream responseStream
);

Parameters

resourceName
A string which specifies the resource on the server. The resource name should be specified using an absolute path which begins with a leading slash. character.
requestStream
A MemoryStream object which contains the data to be submitted to the server. This stream must be readable, otherwise a NotSupported exception will be thrown.
responseStream
A MemoryStream object which will contain the output from the server when the method returns. This stream must be readable and seekable, otherwise a NotSupported exception will be thrown.

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

The PostData method submits the contents of the specified MemoryStream to the web server and returns the result in a MemoryStream object provided by the caller. This method will cause the current thread to block until the operation completes, a timeout occurs or the post is canceled. During the operation, the OnProgress event will fire periodically, enabling the application to update any user interface objects.

See Also

HttpClient Class | SocketTools Namespace | HttpClient.PostData Overload List