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

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

BadRequest BadRequest BadRequest BadRequest BadRequest

The request cannot be fulfilled due to bad syntax.

CannotConnect CannotConnect CannotConnect CannotConnect CannotConnect

Cannot connect to destination.

CertificateCommonNameIsIncorrect CertificateCommonNameIsIncorrect CertificateCommonNameIsIncorrect CertificateCommonNameIsIncorrect CertificateCommonNameIsIncorrect

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

CertificateContainsErrors CertificateContainsErrors CertificateContainsErrors CertificateContainsErrors CertificateContainsErrors

The SSL certificate contains errors.

CertificateExpired CertificateExpired CertificateExpired CertificateExpired CertificateExpired

The SSL certificate has expired.

CertificateIsInvalid CertificateIsInvalid CertificateIsInvalid CertificateIsInvalid CertificateIsInvalid

The SSL certificate is invalid.

CertificateRevoked CertificateRevoked CertificateRevoked CertificateRevoked CertificateRevoked

The SSL certificate has been revoked.

Conflict Conflict Conflict Conflict Conflict

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

ConnectionAborted ConnectionAborted ConnectionAborted ConnectionAborted ConnectionAborted

The connection was aborted.

ConnectionReset ConnectionReset ConnectionReset ConnectionReset ConnectionReset

The connection was reset.

Disconnected Disconnected Disconnected Disconnected Disconnected

The connection was ended.

ErrorHttpInvalidServerResponse ErrorHttpInvalidServerResponse ErrorHttpInvalidServerResponse ErrorHttpInvalidServerResponse ErrorHttpInvalidServerResponse

The server returned an invalid or unrecognized response.

ExpectationFailed ExpectationFailed ExpectationFailed ExpectationFailed ExpectationFailed

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

Forbidden Forbidden Forbidden Forbidden Forbidden

The server has refused the request.

Found Found Found Found Found

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

GatewayTimeout GatewayTimeout GatewayTimeout GatewayTimeout GatewayTimeout

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

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

HostNameNotResolved HostNameNotResolved HostNameNotResolved HostNameNotResolved HostNameNotResolved

Could not resolve provided host name.

HttpsToHttpOnRedirection HttpsToHttpOnRedirection HttpsToHttpOnRedirection HttpsToHttpOnRedirection HttpsToHttpOnRedirection

Redirected from a secure location to an unsecure location.

HttpToHttpsOnRedirection HttpToHttpsOnRedirection HttpToHttpsOnRedirection HttpToHttpsOnRedirection HttpToHttpsOnRedirection

Redirected from a location to a secure location.

HttpVersionNotSupported HttpVersionNotSupported HttpVersionNotSupported HttpVersionNotSupported HttpVersionNotSupported

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

InsufficientRangeSupport InsufficientRangeSupport InsufficientRangeSupport InsufficientRangeSupport InsufficientRangeSupport

The request does not support the range.

InternalServerError InternalServerError InternalServerError InternalServerError InternalServerError

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

LengthRequired LengthRequired LengthRequired LengthRequired LengthRequired

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

MethodNotAllowed MethodNotAllowed MethodNotAllowed MethodNotAllowed MethodNotAllowed

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

MissingContentLengthSupport MissingContentLengthSupport MissingContentLengthSupport MissingContentLengthSupport MissingContentLengthSupport

The request is mising the file size.

MovedPermanently MovedPermanently MovedPermanently MovedPermanently MovedPermanently

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

MultipleChoices MultipleChoices MultipleChoices MultipleChoices MultipleChoices

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

NotAcceptable NotAcceptable NotAcceptable NotAcceptable NotAcceptable

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

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

NotImplemented NotImplemented NotImplemented NotImplemented NotImplemented

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

NotModified NotModified NotModified NotModified NotModified

Indicates the resource has not been modified since last requested.

OperationCanceled OperationCanceled OperationCanceled OperationCanceled OperationCanceled

The operation was canceled.

PaymentRequired PaymentRequired PaymentRequired PaymentRequired PaymentRequired


PreconditionFailed PreconditionFailed PreconditionFailed PreconditionFailed PreconditionFailed

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

ProxyAuthenticationRequired ProxyAuthenticationRequired ProxyAuthenticationRequired ProxyAuthenticationRequired ProxyAuthenticationRequired

The client must first authenticate itself with the proxy.

RedirectFailed RedirectFailed RedirectFailed RedirectFailed RedirectFailed

The request redirect failed.

RequestedRangeNotSatisfiable RequestedRangeNotSatisfiable RequestedRangeNotSatisfiable RequestedRangeNotSatisfiable RequestedRangeNotSatisfiable

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

RequestEntityTooLarge RequestEntityTooLarge RequestEntityTooLarge RequestEntityTooLarge RequestEntityTooLarge

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

RequestTimeout RequestTimeout RequestTimeout RequestTimeout RequestTimeout

The server timed out waiting for the request.

RequestUriTooLong RequestUriTooLong RequestUriTooLong RequestUriTooLong RequestUriTooLong

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

SeeOther SeeOther SeeOther SeeOther SeeOther

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

ServerUnreachable ServerUnreachable ServerUnreachable ServerUnreachable ServerUnreachable

The server is not responding.

ServiceUnavailable ServiceUnavailable ServiceUnavailable ServiceUnavailable ServiceUnavailable

The server is currently unavailable.

TemporaryRedirect TemporaryRedirect TemporaryRedirect TemporaryRedirect TemporaryRedirect

The requested resource resides temporarily under a different URI.

Timeout Timeout Timeout Timeout Timeout

The connection has timed out.

Unauthorized Unauthorized Unauthorized Unauthorized Unauthorized

Authentication has failed or credentials have not yet been provided.

UnexpectedClientError UnexpectedClientError UnexpectedClientError UnexpectedClientError UnexpectedClientError

An unexpected client-side error has occurred.

UnexpectedRedirection UnexpectedRedirection UnexpectedRedirection UnexpectedRedirection UnexpectedRedirection

A request was unexpectedly redirected.

UnexpectedServerError UnexpectedServerError UnexpectedServerError UnexpectedServerError UnexpectedServerError

An unexpected server-side error has occurred.

UnexpectedStatusCode UnexpectedStatusCode UnexpectedStatusCode UnexpectedStatusCode UnexpectedStatusCode

An unexpected status code indicating a failure was received.

Unknown Unknown Unknown Unknown Unknown

An unknown error has occurred.

UnsupportedMediaType UnsupportedMediaType UnsupportedMediaType UnsupportedMediaType UnsupportedMediaType

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

UseProxy UseProxy UseProxy UseProxy UseProxy

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);
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));

See Also