System.Net.WebException.Response Property

Gets the response that the remote host returned.

Syntax

public WebResponse Response { get; }

Value

A System.Net.WebResponse instance containing the error response if one is available; otherwise, null .

Remarks

Some Internet protocols, such as HTTP, return otherwise valid responses indicating that an error has occurred at the protocol level. When the response to an Internet request indicates an error, WebRequest.GetResponse sets the WebException.Status property to WebExceptionStatus.ProtocolError and provides the System.Net.WebResponse that contains the error message in the WebException.Response property of the System.Net.WebException that was thrown. The application can examine the System.Net.WebResponse to determine the actual error.

Requirements

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