GetRequestStream Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets a Stream object to use to write request data.

Namespace:  System.Net
Assembly:  System.Http (in System.Http.dll)

virtual Stream^ GetRequestStream() override

Return Value

Type: System.IO..::..Stream
A Stream to use to write request data.

The GetRequestStream method returns a stream to use to send data for the HttpWebRequest. After the Stream object has been returned, you can send data with the HttpWebRequest by using the Stream..::..Write method.

If an application needs to set the value of the ContentLength property, then this must be done before retrieving the stream.

You must call the Stream..::..Close method to close the stream and release the connection for reuse. Failure to close the stream causes your application to run out of connections.