Response Property
Collapse the table of content
Expand the table of content

WebException.Response Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets the response that the remote host returned.

Namespace:  System.Net
Assembly:  System.Net (in System.Net.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, 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.BeginGetResponse initiates a request for a response and WebRequest.EndGetResponse sets the Status property 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.

When Status is UnknownError, additional details about the protocol specific response error may be available using the Response property. If the Response property is not null, this indicates that the remote server responded with an error code. In this case, the Response property can be queried for more specific information about the response.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft