System.Net.WebException.Response Property

Gets the response that the remote host returned.


public WebResponse Response { get; }


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


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.


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