Mono Class Library: System.Net.HttpWebRequest Overview | Members

System.Net.HttpWebRequest.GetRequestStream Method

Returns a System.IO.Stream for writing data to the Internet resource requested by the current instance. [Edit]

public override System.IO.Stream GetRequestStream ()

Returns

A System.IO.Stream for writing data to an Internet resource requested by the current instance. [Edit]

Exceptions

TypeReason
System.Net.ProtocolViolationException

The HttpWebRequest.Method property of the current instance is "GET" or "HEAD".

-or-

The HttpWebRequest.ContentLength property of the current instance is not set.

[Edit]
InvalidOperationException

The HttpWebRequest.GetRequestStream method was called more than once.

-or-

No writeable stream is available.

[Edit]
System.Net.WebException

HttpWebRequest.Abort was previously called.

-or-

The timeout period for the request expired.

-or-

An error occurred while processing the request.

[Edit]

Remarks

The value of the HttpWebRequest.ContentLength property is required to be set before writing data to the stream.

Note:

This method returns a stream to use to send data for the System.Net.HttpWebRequest. Once the System.IO.Stream instance has been returned, data can be sent with the System.Net.HttpWebRequest by using the System.IO.Stream.Write(Byte[], int, int) method.

Call the System.IO.Stream.Close method to close the stream and release the connection for reuse. Failure to close the stream might cause the application to run out of connections.

This method overrides WebRequest.GetRequestStream.

[Edit]

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0