AuthenticationException Class
Assembly: System.Net.Primitives.dll
Represents the exceptions that occur during authentication.
Syntax
public sealed class AuthenticationException : SystemException
Inheritance Hierarchy
Object
Exception
SystemException
AuthenticationException
Remarks
The AuthenticationException class is used to indicate errors that occur when a client and server attempt to authenticate each other. This can happen for a variety of reasons, including incorrect credentials, expired certificates, or network configuration issues.
When an authentication operation fails, an instance of AuthenticationException is typically thrown. You can catch this exception to handle authentication failures gracefully, perhaps by prompting the user for correct credentials or logging the error for later analysis.
Constructors
| Name | Description |
|---|---|
AuthenticationException() |
Initializes a new instance of the AuthenticationException class. |
AuthenticationException(String message) |
Initializes a new instance of the AuthenticationException class with a specified error message. |
AuthenticationException(String message, Exception innerException) |
Initializes a new instance of the AuthenticationException class with a specified error message and a reference to the inner exception that is the cause of this exception. |
Fields
The AuthenticationException class does not expose any public fields beyond those inherited from its base classes.
Properties
| Name | Description |
|---|---|
Data |
(Inherited from Exception) Gets a dictionary of key/value pairs that provide additional user-defined information about the exception. |
HelpLink |
(Inherited from Exception) Gets or sets a link to the help file that defines the exception. |
HResult |
(Inherited from Exception) Gets or sets HRESULT, which is a coded numerical value that is assigned to a specific exception. |
InnerException |
(Inherited from Exception) Gets the exception that is the cause of the current exception. |
Message |
(Inherited from Exception) Gets an error message that explains the reason for the exception. |
Source |
(Inherited from Exception) Gets or sets the name of the application or the object that causes the error. |
StackTrace |
(Inherited from Exception) Gets a string representation of the immediate frame in the call stack. |
TargetSite |
(Inherited from Exception) Gets the method that throws the current exception. |
Constructors
AuthenticationException()
Initializes a new instance of the AuthenticationException class.
AuthenticationException(String message)
Initializes a new instance of the AuthenticationException class with a specified error message.
Parameters:
message: The message that describes the exception.
AuthenticationException(String message, Exception innerException)
Initializes a new instance of the AuthenticationException class with a specified error message and a reference to the inner exception that is the cause of this exception.
Parameters:
message: The error message that explains the reason for the exception.innerException: The exception that is the cause of the current exception. IfinnerExceptionis notnull, the current exception is raised in response to theinnerException.