HttpRequestException Constructors

Definition

Initializes a new instance of the HttpRequestException class.

Overloads

HttpRequestException()

Initializes a new instance of the HttpRequestException class.

HttpRequestException(String)

Initializes a new instance of the HttpRequestException class with a specific message that describes the current exception.

HttpRequestException(String, Exception)

Initializes a new instance of the HttpRequestException class with a specific message that describes the current exception and an inner exception.

HttpRequestException(String, Exception, Nullable<HttpStatusCode>)

Initializes a new instance of the HttpRequestException class with a specific message that describes the current exception, an inner exception, and an HTTP status code.

HttpRequestException(HttpRequestError, String, Exception, Nullable<HttpStatusCode>)

Initializes a new instance of the HttpRequestException class with a specific message an inner exception, and an HTTP status code and an HttpRequestError.

HttpRequestException()

Source:
HttpRequestException.cs
Source:
HttpRequestException.cs
Source:
HttpRequestException.cs

Initializes a new instance of the HttpRequestException class.

C#
public HttpRequestException();

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

HttpRequestException(String)

Source:
HttpRequestException.cs
Source:
HttpRequestException.cs
Source:
HttpRequestException.cs

Initializes a new instance of the HttpRequestException class with a specific message that describes the current exception.

C#
public HttpRequestException(string message);
C#
public HttpRequestException(string? message);

Parameters

message
String

A message that describes the current exception.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

HttpRequestException(String, Exception)

Source:
HttpRequestException.cs
Source:
HttpRequestException.cs
Source:
HttpRequestException.cs

Initializes a new instance of the HttpRequestException class with a specific message that describes the current exception and an inner exception.

C#
public HttpRequestException(string message, Exception inner);
C#
public HttpRequestException(string? message, Exception? inner);

Parameters

message
String

A message that describes the current exception.

inner
Exception

The inner exception.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

HttpRequestException(String, Exception, Nullable<HttpStatusCode>)

Source:
HttpRequestException.cs
Source:
HttpRequestException.cs
Source:
HttpRequestException.cs

Initializes a new instance of the HttpRequestException class with a specific message that describes the current exception, an inner exception, and an HTTP status code.

C#
public HttpRequestException(string? message, Exception? inner, System.Net.HttpStatusCode? statusCode);

Parameters

message
String

A message that describes the current exception.

inner
Exception

The inner exception.

statusCode
Nullable<HttpStatusCode>

The HTTP status code.

Applies to

.NET 9 and other versions
Product Versions
.NET 5, 6, 7, 8, 9

HttpRequestException(HttpRequestError, String, Exception, Nullable<HttpStatusCode>)

Source:
HttpRequestException.cs
Source:
HttpRequestException.cs

Initializes a new instance of the HttpRequestException class with a specific message an inner exception, and an HTTP status code and an HttpRequestError.

C#
public HttpRequestException(System.Net.Http.HttpRequestError httpRequestError, string? message = default, Exception? inner = default, System.Net.HttpStatusCode? statusCode = default);

Parameters

httpRequestError
HttpRequestError

The HttpRequestError that caused the exception.

message
String

A message that describes the current exception.

inner
Exception

The inner exception.

statusCode
Nullable<HttpStatusCode>

The HTTP status code.

Applies to

.NET 9 and .NET 8
Product Versions
.NET 8, 9