Search Results for

    Show / Hide Table of Contents

    Class WebException

    Defines the exception that is thrown by WebRequest instances when an error occurs.

    Inheritance
    object
    Exception
    SystemException
    InvalidOperationException
    WebException
    Inherited Members
    Exception.HResult
    Exception.ToString()
    Exception.Message
    Exception.InnerException
    Exception.StackTrace
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: System.Net
    Assembly: System.Net.Http.dll
    Syntax
    public class WebException : InvalidOperationException
    Remarks

    This class is a subclass of InvalidOperationException that contains a WebExceptionStatus and possibly a reference to a WebResponse. The WebResponse is only present if there is a response from the remote server.

    Constructors

    WebException()

    The default constructor.

    Declaration
    public WebException()

    WebException(string, Exception, WebExceptionStatus, WebResponse)

    Constructs a WebException based on the specified message string, inner exception, WebExceptionStatus, and WebResponse.

    Declaration
    public WebException(string message, Exception inner, WebExceptionStatus status, WebResponse response)
    Parameters
    Type Name Description
    string message

    Message string for exception.

    Exception inner

    The exception that caused this exception.

    WebExceptionStatus status

    The network status of the exception.

    WebResponse response

    The WebResponse we have.

    WebException(string, Exception)

    Constructs a WebException based on the specified message string and inner exception.

    Declaration
    public WebException(string message, Exception innerException)
    Parameters
    Type Name Description
    string message

    The message string for the exception.

    Exception innerException

    The exception that caused this exception.

    WebException(string, WebExceptionStatus)

    Constructs a WebException based on the specified message string and WebExceptionStatus.

    Declaration
    public WebException(string message, WebExceptionStatus status)
    Parameters
    Type Name Description
    string message

    The message string for the exception.

    WebExceptionStatus status

    The network status of the exception.

    WebException(string)

    Constructs a WebException based on the specified message string.

    Declaration
    public WebException(string message)
    Parameters
    Type Name Description
    string message

    The message string for the exception.

    Properties

    Response

    Gets the response that the remote host returned.

    Declaration
    public WebResponse Response { get; }
    Property Value
    Type Description
    WebResponse

    If a response is available from the Internet resource, a WebResponse instance that contains the error response from an Internet resource; otherwise, null.

    Status

    Gets the WebExceptionStatus code.

    Declaration
    public WebExceptionStatus Status { get; }
    Property Value
    Type Description
    WebExceptionStatus

    One of the WebExceptionStatus values.

    Extension Methods

    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    In This Article
    Back to top Copyright © 2023 nanoFramework Contributors
    Generated by DocFX