System.Net.WebResponse.Close Method

When overridden by a descendant class, closes the response stream.

Syntax

public virtual void Close ()

Exceptions

TypeReason
NotSupportedExceptionThis method is not implemented in the derived class.

Remarks

The WebResponse.Close method cleans up the resources used by a System.Net.WebResponse and closes the underlying stream by calling the System.IO.Stream.Close method.

Note:

The response must be closed to avoid running out of system resources. The response stream can be closed by calling System.IO.Stream.Close or WebResponse.Close.

Note:

The System.Net.WebResponse class is an abstract class. The actual behavior of System.Net.WebResponse instances at run time is determined by the descendant class returned by WebRequest.GetResponse. For more information about default values and exceptions, please see the documentation for the descendant classes, such as System.Net.HttpWebResponse and System.Net.FileWebResponse.

Requirements

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