Export (0) Print
Expand All

WebException Constructor (String, Exception, WebExceptionStatus, WebResponse)

Initializes a new instance of the WebException class with the specified error message, nested exception, status, and response.

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

new : 
        message:string * 
        innerException:Exception * 
        status:WebExceptionStatus * 
        response:WebResponse -> WebException

Parameters

message
Type: System.String

The text of the error message.

innerException
Type: System.Exception

A nested exception.

status
Type: System.Net.WebExceptionStatus

One of the WebExceptionStatus values.

response
Type: System.Net.WebResponse

A WebResponse instance that contains the response from the remote host.

The WebException instance is initialized with the Message property set to the value of message, the InnerException property set to the value of innerException, the Status property set to the value of status, and the Response property set to the value of response. If message is a null reference (Nothing in Visual Basic), the Message property is initialized to a system-supplied message.

The following example throws a WebException by specifying an error message and a WebExceptionStatus.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft