WebErrorStatus WebErrorStatus WebErrorStatus WebErrorStatus WebErrorStatus Enum


Defines errors encountered during operations involving web services, such as authentication, proxy configuration, and destination URIs.

public : enum class WebErrorStatus
enum class winrt::Windows::Web::WebErrorStatus : int32_t
public enum WebErrorStatus
Public Enum WebErrorStatus
var value = Windows.Web.WebErrorStatus.badGateway;

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


BadGateway BadGateway BadGateway BadGateway BadGateway 502

The server was acting as a gateway or proxy and received an invalid response from the upstream server.

BadRequest BadRequest BadRequest BadRequest BadRequest 400

The request cannot be fulfilled due to bad syntax.

CannotConnect CannotConnect CannotConnect CannotConnect CannotConnect 14

Cannot connect to destination.

CertificateCommonNameIsIncorrect CertificateCommonNameIsIncorrect CertificateCommonNameIsIncorrect CertificateCommonNameIsIncorrect CertificateCommonNameIsIncorrect 1

The SSL certificate common name does not match the web address.

CertificateContainsErrors CertificateContainsErrors CertificateContainsErrors CertificateContainsErrors CertificateContainsErrors 3

The SSL certificate contains errors.

CertificateExpired CertificateExpired CertificateExpired CertificateExpired CertificateExpired 2

The SSL certificate has expired.

CertificateIsInvalid CertificateIsInvalid CertificateIsInvalid CertificateIsInvalid CertificateIsInvalid 5

The SSL certificate is invalid.

CertificateRevoked CertificateRevoked CertificateRevoked CertificateRevoked CertificateRevoked 4

The SSL certificate has been revoked.

Conflict Conflict Conflict Conflict Conflict 409

Indicates that the request could not be processed because of conflict in the request.

ConnectionAborted ConnectionAborted ConnectionAborted ConnectionAborted ConnectionAborted 9

The connection was aborted.

ConnectionReset ConnectionReset ConnectionReset ConnectionReset ConnectionReset 10

The connection was reset.

Disconnected Disconnected Disconnected Disconnected Disconnected 11

The connection was ended.

ErrorHttpInvalidServerResponse ErrorHttpInvalidServerResponse ErrorHttpInvalidServerResponse ErrorHttpInvalidServerResponse ErrorHttpInvalidServerResponse 8

The server returned an invalid or unrecognized response.

ExpectationFailed ExpectationFailed ExpectationFailed ExpectationFailed ExpectationFailed 417

The server cannot meet the requirements of the Expect request-header field.

Forbidden Forbidden Forbidden Forbidden Forbidden 403

The server has refused the request.

Found Found Found Found Found 302

The resource was found but is available in a location different from the one included in the request.

GatewayTimeout GatewayTimeout GatewayTimeout GatewayTimeout GatewayTimeout 504

The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.

Gone Gone Gone Gone Gone 410

Indicates that the resource requested is no longer available and will not be available again.

HostNameNotResolved HostNameNotResolved HostNameNotResolved HostNameNotResolved HostNameNotResolved 15

Could not resolve provided host name.

HttpsToHttpOnRedirection HttpsToHttpOnRedirection HttpsToHttpOnRedirection HttpsToHttpOnRedirection HttpsToHttpOnRedirection 13

Redirected from a secure location to an unsecure location.

HttpToHttpsOnRedirection HttpToHttpsOnRedirection HttpToHttpsOnRedirection HttpToHttpsOnRedirection HttpToHttpsOnRedirection 12

Redirected from a location to a secure location.

HttpVersionNotSupported HttpVersionNotSupported HttpVersionNotSupported HttpVersionNotSupported HttpVersionNotSupported 505

The server does not support the HTTP protocol version used in the request.

InsufficientRangeSupport InsufficientRangeSupport InsufficientRangeSupport InsufficientRangeSupport InsufficientRangeSupport 22

The request does not support the range.

InternalServerError InternalServerError InternalServerError InternalServerError InternalServerError 500

A generic error message, given when no more specific message is suitable.

LengthRequired LengthRequired LengthRequired LengthRequired LengthRequired 411

The request did not specify the length of its content, which is required by the requested resource.

MethodNotAllowed MethodNotAllowed MethodNotAllowed MethodNotAllowed MethodNotAllowed 405

A request was made of a resource using a request method not supported by that resource.

MissingContentLengthSupport MissingContentLengthSupport MissingContentLengthSupport MissingContentLengthSupport MissingContentLengthSupport 23

The request is mising the file size.

MovedPermanently MovedPermanently MovedPermanently MovedPermanently MovedPermanently 301

This and all future requests should be directed to the given URI.

MultipleChoices MultipleChoices MultipleChoices MultipleChoices MultipleChoices 300

The requested URL represents a high level grouping of which lower level selections need to be made.

NotAcceptable NotAcceptable NotAcceptable NotAcceptable NotAcceptable 406

The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request.

NotFound NotFound NotFound NotFound NotFound 404

The requested resource could not be found but may be available again in the future.

NotImplemented NotImplemented NotImplemented NotImplemented NotImplemented 501

The server either does not recognize the request method, or it lacks the ability to fulfill the request.

NotModified NotModified NotModified NotModified NotModified 304

Indicates the resource has not been modified since last requested.

OperationCanceled OperationCanceled OperationCanceled OperationCanceled OperationCanceled 16

The operation was canceled.

PaymentRequired PaymentRequired PaymentRequired PaymentRequired PaymentRequired 402


PreconditionFailed PreconditionFailed PreconditionFailed PreconditionFailed PreconditionFailed 412

The server does not meet one of the preconditions that the requester put on the request.

ProxyAuthenticationRequired ProxyAuthenticationRequired ProxyAuthenticationRequired ProxyAuthenticationRequired ProxyAuthenticationRequired 407

The client must first authenticate itself with the proxy.

RedirectFailed RedirectFailed RedirectFailed RedirectFailed RedirectFailed 17

The request redirect failed.

RequestedRangeNotSatisfiable RequestedRangeNotSatisfiable RequestedRangeNotSatisfiable RequestedRangeNotSatisfiable RequestedRangeNotSatisfiable 416

The client has asked for a portion of the file, but the server cannot supply that portion.

RequestEntityTooLarge RequestEntityTooLarge RequestEntityTooLarge RequestEntityTooLarge RequestEntityTooLarge 413

The request is larger than the server is willing or able to process.

RequestTimeout RequestTimeout RequestTimeout RequestTimeout RequestTimeout 408

The server timed out waiting for the request.

RequestUriTooLong RequestUriTooLong RequestUriTooLong RequestUriTooLong RequestUriTooLong 414

Provided URI length exceeds the maximum length the server can process.

SeeOther SeeOther SeeOther SeeOther SeeOther 303

The response to the request can be found under another URI using a GET method.

ServerUnreachable ServerUnreachable ServerUnreachable ServerUnreachable ServerUnreachable 6

The server is not responding.

ServiceUnavailable ServiceUnavailable ServiceUnavailable ServiceUnavailable ServiceUnavailable 503

The server is currently unavailable.

TemporaryRedirect TemporaryRedirect TemporaryRedirect TemporaryRedirect TemporaryRedirect 307

The requested resource resides temporarily under a different URI.

Timeout Timeout Timeout Timeout Timeout 7

The connection has timed out.

Unauthorized Unauthorized Unauthorized Unauthorized Unauthorized 401

Authentication has failed or credentials have not yet been provided.

UnexpectedClientError UnexpectedClientError UnexpectedClientError UnexpectedClientError UnexpectedClientError 20

An unexpected client-side error has occurred.

UnexpectedRedirection UnexpectedRedirection UnexpectedRedirection UnexpectedRedirection UnexpectedRedirection 19

A request was unexpectedly redirected.

UnexpectedServerError UnexpectedServerError UnexpectedServerError UnexpectedServerError UnexpectedServerError 21

An unexpected server-side error has occurred.

UnexpectedStatusCode UnexpectedStatusCode UnexpectedStatusCode UnexpectedStatusCode UnexpectedStatusCode 18

An unexpected status code indicating a failure was received.

Unknown Unknown Unknown Unknown Unknown 0

An unknown error has occurred.

UnsupportedMediaType UnsupportedMediaType UnsupportedMediaType UnsupportedMediaType UnsupportedMediaType 415

The request entity has a media type which the server or resource does not support.

UseProxy UseProxy UseProxy UseProxy UseProxy 305

The requested resource must be accessed through the proxy given by the Location field.


A WebErrorStatus value is returned by Windows.Web.WebError.GetStatus, Windows.Networking.WebSocketError.GetStatus, and Windows.Networking.BackgroundTransfer.GetStatus.

This example demonstrates how to use WebErrorStatus to display a different error message depending on the type of error. In this example, the WebErrorStatus value is returned by Windows.Networking.WebSocketError.GetStatus.

using Windows.Web;
using Windows.Networking.Sockets;

// Pointer back to the main page. Needed to call methods in MainPage such as NotifyUser()
MainPage rootPage = MainPage.Current;

WebErrorStatus status = WebSocketError.GetStatus(ex.GetBaseException().HResult);

if (status == WebErrorStatus.CannotConnect ||
    status == WebErrorStatus.NotFound || 
    status == WebErrorStatus.RequestTimeout)
    rootPage.NotifyUser("Cannot connect to the server", NotifyType.ErrorMessage);
    rootPage.NotifyUser("Error: " + status, NotifyType.ErrorMessage);
// Pointer back to the main page. Needed to call methods in MainPage such as NotifyUser().
m_rootPage = MainPage::Current();

Windows::Web::WebErrorStatus status{ Windows::Networking::Sockets::WebSocketError::GetStatus(exception.to_abi()) };

if (status == Windows::Web::WebErrorStatus::CannotConnect ||
    status == Windows::Web::WebErrorStatus::NotFound ||
    status == Windows::Web::WebErrorStatus::RequestTimeout)
    m_rootPage.NotifyUser(L"Cannot connect to the server", NotifyType::ErrorMessage);
    m_rootPage.NotifyUser(std::wstring(L"Error: ") + exception.message().c_str(), NotifyType::ErrorMessage);
using namespace Windows::Web;
using namespace Windows::Networking::Sockets;

// Pointer back to the main page. Needed to call methods in MainPage such as NotifyUser()
rootPage = MainPage::Current;

WebErrorStatus status = WebSocketError::GetStatus(exception->HResult);

if (status == WebErrorStatus::CannotConnect || 
    status == WebErrorStatus::NotFound || 
    status == WebErrorStatus::RequestTimeout)
    rootPage->NotifyUser("Cannot connect to the server", NotifyType::ErrorMessage);
    rootPage->NotifyUser("Error: " + status.ToString(), NotifyType::ErrorMessage);
var errorStatus = Windows.Networking.Sockets.WebSocketError.getStatus(error.number);
if (errorStatus === Windows.Web.WebErrorStatus.cannotConnect ||
    errorStatus === Windows.Web.WebErrorStatus.notFound ||
    errorStatus === Windows.Web.WebErrorStatus.requestTimeout) {
    WinJS.log && WinJS.log("Cannot connect to the server");
else {
    WinJS.log && WinJS.log("Failed to connect: " + getError(error));

Version history

Windows version SDK version Value added
1709 16299 InsufficientRangeSupport
1709 16299 MissingContentLengthSupport

See also