Partager via


WebException.Response Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the response that the remote host returned.

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

Syntax

'Declaration
Public ReadOnly Property Response As WebResponse
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, nulla null reference (Nothing in Visual Basic).

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.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.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.