WebResponse.GetResponseStream Method
When overridden in a descendant class, returns the data stream from the Internet resource.
Namespace: System.Net
Assembly: System (in System.dll)
| Exception | Condition |
|---|---|
| NotSupportedException | Any attempt is made to access the method, when the method is not overridden in a descendant class. |
The GetResponseStream method returns the data stream from the Internet resource.
Note |
|---|
The response stream must be closed to avoid running out of system resources. The response stream can be closed by calling Stream.Close or Close |
The following example uses GetResponseStream to return a StreamReader instance. A small local buffer is used to read data from the StreamReader and output it to the console.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note