Class WebException
Defines the exception that is thrown by WebRequest instances when an error occurs.
Inherited Members
Namespace: System.Net
Assembly: System.Net.Http.dll
Syntax
public class WebException : InvalidOperationException
Remarks
This class is a subclass of
Constructors
WebException()
The default constructor.
Declaration
public WebException()
WebException(string, Exception, WebExceptionStatus, WebResponse)
Constructs a
Declaration
public WebException(string message, Exception inner, WebExceptionStatus status, WebResponse response)
Parameters
Type | Name | Description |
---|---|---|
string | message | Message string for exception. |
Exception | inner | The exception that caused this exception. |
WebExceptionStatus | status | The network status of the exception. |
WebResponse | response | The |
WebException(string, Exception)
Constructs a
Declaration
public WebException(string message, Exception innerException)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message string for the exception. |
Exception | innerException | The exception that caused this exception. |
WebException(string, WebExceptionStatus)
Constructs a
Declaration
public WebException(string message, WebExceptionStatus status)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message string for the exception. |
WebExceptionStatus | status | The network status of the exception. |
WebException(string)
Constructs a
Declaration
public WebException(string message)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message string for the exception. |
Properties
Response
Gets the response that the remote host returned.
Declaration
public WebResponse Response { get; }
Property Value
Type | Description |
---|---|
WebResponse | If a response is available from the Internet resource, a
|
Status
Gets the
Declaration
public WebExceptionStatus Status { get; }
Property Value
Type | Description |
---|---|
WebExceptionStatus | One of the WebExceptionStatus values. |