WebErrorStatus enumeration
Collapse the table of content
Expand the table of content

WebErrorStatus enumeration

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


public enum class WebErrorStatus


The WebErrorStatus enumeration has these members.

Unknown | unknown0

An unknown error has occurred.

CertificateCommonNameIsIncorrect | certificateCommonNameIsIncorrect1

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

CertificateExpired | certificateExpired2

The SSL certificate has expired.

CertificateContainsErrors | certificateContainsErrors3

The SSL certificate contains errors.

CertificateRevoked | certificateRevoked4

The SSL certificate has been revoked.

CertificateIsInvalid | certificateIsInvalid5

The SSL certificate is invalid.

ServerUnreachable | serverUnreachable6

The server is not responding.

Timeout | timeout7

The connection has timed out.

ErrorHttpInvalidServerResponse | errorHttpInvalidServerResponse8

The server returned an invalid or unrecognized response.

ConnectionAborted | connectionAborted9

The connection was aborted.

ConnectionReset | connectionReset10

The connection was reset.

Disconnected | disconnected11

The connection was ended.

HttpToHttpsOnRedirection | httpToHttpsOnRedirection12

Redirected from a location to a secure location.

HttpsToHttpOnRedirection | httpsToHttpOnRedirection13

Redirected from a secure location to an unsecure location.

CannotConnect | cannotConnect14

Cannot connect to destination.

HostNameNotResolved | hostNameNotResolved15

Could not resolve provided host name.

OperationCanceled | operationCanceled16

The operation was canceled.

RedirectFailed | redirectFailed17

The request redirect failed.

UnexpectedStatusCode | unexpectedStatusCode18

An unexpected status code indicating a failure was received.

UnexpectedRedirection | unexpectedRedirection19

A request was unexpectedly redirected.

UnexpectedClientError | unexpectedClientError20

An unexpected client-side error has occurred.

UnexpectedServerError | unexpectedServerError21

An unexpected server-side error has occurred.

MultipleChoices | multipleChoices300

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

MovedPermanently | movedPermanently301

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

Found | found302

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

SeeOther | seeOther303

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

NotModified | notModified304

Indicates the resource has not been modified since last requested.

UseProxy | useProxy305

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

TemporaryRedirect | temporaryRedirect307

The requested resource resides temporarily under a different URI.

BadRequest | badRequest400

The request cannot be fulfilled due to bad syntax.

Unauthorized | unauthorized401

Authentication has failed or credentials have not yet been provided.

PaymentRequired | paymentRequired402


Forbidden | forbidden403

The server has refused the request.

NotFound | notFound404

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

MethodNotAllowed | methodNotAllowed405

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

NotAcceptable | notAcceptable406

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

ProxyAuthenticationRequired | proxyAuthenticationRequired407

The client must first authenticate itself with the proxy.

RequestTimeout | requestTimeout408

The server timed out waiting for the request.

Conflict | conflict409

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

Gone | gone410

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

LengthRequired | lengthRequired411

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

PreconditionFailed | preconditionFailed412

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

RequestEntityTooLarge | requestEntityTooLarge413

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

RequestUriTooLong | requestUriTooLong414

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

UnsupportedMediaType | unsupportedMediaType415

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

RequestedRangeNotSatisfiable | requestedRangeNotSatisfiable416

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

ExpectationFailed | expectationFailed417

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

InternalServerError | internalServerError500

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

NotImplemented | notImplemented501

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

BadGateway | badGateway502

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

ServiceUnavailable | serviceUnavailable503

The server is currently unavailable.

GatewayTimeout | gatewayTimeout504

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

HttpVersionNotSupported | httpVersionNotSupported505

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


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

The following 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 | getStatus.

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

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::Web [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::Web [C++]





See also

Windows.Web.WebError.GetStatus | getStatus
Windows.Networking.WebSocketError.GetStatus | getStatus
Windows.Networking.BackgroundTransfer.GetStatus | getStatus
Background Transfer Download sample



© 2016 Microsoft