1 out of 3 rated this helpful - Rate this topic

WebExceptionStatus Enumeration

Defines status codes for the WebException class.

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

public enum WebExceptionStatus
public enum WebExceptionStatus
public enum WebExceptionStatus
  Member name Description
CacheEntryNotFound The specified cache entry was not found. 
Supported by the .NET Compact Framework ConnectFailure The remote service point could not be contacted at the transport level. 
Supported by the .NET Compact Framework ConnectionClosed The connection was prematurely closed. 
Supported by the .NET Compact Framework KeepAliveFailure The connection for a request that specifies the Keep-alive header was closed unexpectedly. 
MessageLengthLimitExceeded A message was received that exceeded the specified limit when sending a request or receiving a response from the server. 
Supported by the .NET Compact Framework NameResolutionFailure The name resolver service could not resolve the host name. 
Supported by the .NET Compact Framework Pending An internal asynchronous request is pending. 
Supported by the .NET Compact Framework PipelineFailure The request was a piplined request and the connection was closed before the response was received. 
Supported by the .NET Compact Framework ProtocolError The response received from the server was complete but indicated a protocol-level error. For example, an HTTP protocol error such as 401 Access Denied would use this status. 
Supported by the .NET Compact Framework ProxyNameResolutionFailure The name resolver service could not resolve the proxy host name. 
Supported by the .NET Compact Framework ReceiveFailure A complete response was not received from the remote server. 
Supported by the .NET Compact Framework RequestCanceled The request was canceled, the WebRequest.Abort method was called, or an unclassifiable error occurred. This is the default value for Status
RequestProhibitedByCachePolicy The request was not permitted by the cache policy. In general, this occurs when a request is not cacheable and the effective policy prohibits sending the request to the server. You might receive this status if a request method implies the presence of a request body, a request method requires direct interaction with the server, or a request contains a conditional header. 
RequestProhibitedByProxy This request was not permitted by the proxy. 
Supported by the .NET Compact Framework SecureChannelFailure An error occurred while establishing a connection using SSL. 
Supported by the .NET Compact Framework SendFailure A complete request could not be sent to the remote server. 
Supported by the .NET Compact Framework ServerProtocolViolation The server response was not a valid HTTP response. 
Supported by the .NET Compact Framework Success No error was encountered. 
Supported by the .NET Compact Framework Timeout No response was received during the time-out period for a request. 
Supported by the .NET Compact Framework TrustFailure A server certificate could not be validated. 
UnknownError An exception of unknown type has occurred. 

The WebExceptionStatus enumeration defines the status codes assigned to the Status property.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
WebExceptionStatus ENUM using PowerShell
# Enum-WebExceptionStatus.ps1
# Demontrates the System.Net.WebExeceptionStatus ENUM
# Thomas Lee - tfl@psp.co.uk

$enums=[enum]::GetValues([system.net.webexceptionstatus])
"System.Net.WebExceptionStatus ENUM has {0} possible values:" -f $enums.count
$i=1
$enums|%{"Value {0,-2}: {1}" -f $i,$_.tostring();$i++}
""
# Checking against two ENUM values 
$ToCheck1 = "pending"
$ToCheck2 = "Foobar"

if ($ToCheck1 -eq  [system.net.webexceptionstatus]::pending)
{"`$ToCheck1 is Pending"}
else
{"`$ToCheck1 is NOT Pending"}

if ($ToCheck2 -eq [system.net.webexceptionstatus]::pending)
{"`$ToCheck2 is Pending"}
else
{"`$ToCheck2 is NOT Pending"}

This script produces the following output:


System.Net.WebExceptionStatus ENUM has 21 possible values:
Value 1 : Success
Value 2 : NameResolutionFailure
Value 3 : ConnectFailure
Value 4 : ReceiveFailure
Value 5 : SendFailure
Value 6 : PipelineFailure
Value 7 : RequestCanceled
Value 8 : ProtocolError
Value 9 : ConnectionClosed
Value 10: TrustFailure
Value 11: SecureChannelFailure
Value 12: ServerProtocolViolation
Value 13: KeepAliveFailure
Value 14: Pending
Value 15: Timeout
Value 16: ProxyNameResolutionFailure
Value 17: UnknownError
Value 18: MessageLengthLimitExceeded
Value 19: CacheEntryNotFound
Value 20: RequestProhibitedByCachePolicy
Value 21: RequestProhibitedByProxy

$ToCheck1 is Pending
$ToCheck2 is NOT Pending