System.Net.Security.AuthenticationException Class
Represents errors that occur during authentication.
System.Net.SecurityAssembly:
System.Net.Primitives (in .NET Core), System (in .NET Framework)
Introduction
The AuthenticationException class is a specific exception type used to indicate that an error has occurred during the process of authenticating a network connection. This typically happens when security protocols or credentials fail, preventing a secure and trusted communication channel from being established.
Common scenarios where this exception might be thrown include:
- SSL/TLS certificate validation failures.
- Incorrect username or password during authentication.
- Issues with security negotiation or handshake.
- Server or client misconfigurations related to security.
Syntax
The following shows the syntax for the AuthenticationException class:
[SerializableAttribute]
public class AuthenticationException : SystemException
{
// Fields
// Constructors
// Properties
// Methods
}
Fields
The AuthenticationException class does not declare any public static fields.
Constructors
AuthenticationException()
Initializes a new instance of the AuthenticationException class.
public AuthenticationException();
AuthenticationException(string message)
Initializes a new instance of the AuthenticationException class with a specified error message.
public AuthenticationException(string 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.
public AuthenticationException(string message, Exception innerException);
Properties
In addition to the members inherited from SystemException, the AuthenticationException class exposes no additional properties.
Message(inherited fromSystemException): Gets the message string.InnerException(inherited fromSystemException): Gets the exception that is the cause of the current exception.StackTrace(inherited fromSystemException): Gets a string representation of the immediate frames of the call stack.
Methods
The AuthenticationException class does not override any methods from its base class and does not declare any new methods.
Inheritance Hierarchy
Object
Exception
SystemException
AuthenticationException
Requirements
Supported in:
- .NET Core 2.0
- .NET Framework 4.5
- .NET Standard 1.3
- UWP
Frameworks:
- .NET Core
- .NET Framework
- .NET Standard
- Universal Windows Platform (UWP)