Response Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets the response that the remote host returned.

Namespace:  System.Net
Assembly:  System.Http (in System.Http.dll)

public WebResponse Response { get; }

Property Value

Type: System.Net..::..WebResponse
If a response is available from the Internet resource, a WebResponse instance that contains the error response from an Internet resource; otherwise, nullNothingnullptrunita null reference (Nothing in Visual Basic).

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 Status property to WebExceptionStatus..::..ProtocolError and provides the WebResponse that contains the error message in the Response property of the WebException that was thrown. The application can examine the WebResponse to determine the actual error.