System.Net.HttpWebResponse.GetResponseStream Method

Gets the stream that is used to read the body of the response from the server.

Syntax

public override System.IO.Stream GetResponseStream ()

Returns

A System.IO.Stream containing the body of the response.

Exceptions

TypeReason
ObjectDisposedExceptionThe current instance has been disposed.

Remarks

The HttpWebResponse.GetResponseStream method returns the data stream from the requested Internet resource.

Note:

You must call either the System.IO.Stream.Close or the HttpWebResponse.Close method to close the stream and release the connection for reuse. It is not necessary to call both System.IO.Stream.Close and HttpWebResponse.Close, but doing so does not cause an error. Failure to close the stream will cause your application to run out of connections.

Note:

This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

Requirements

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