System.Net.Security.HostPolicyFlags Enumeration

Specifies flags that control how the host policy affects network security operations.

Syntax

public enum HostPolicyFlags
Assembly: System (in System.dll)

Members

Member name Description
NoFlags
No host policy flags are specified. This is the default value.
IgnoreInvalidCerts
Invalid certificates are ignored. This means that certificates that are not valid for the host are still accepted. This is not recommended for production environments.
IgnoreNoRevocationCheck
Revocation checking is ignored. This means that certificates that have been revoked are still accepted. This is not recommended for production environments.
IgnoreNotTimeValid
Certificates that are not time-valid (i.e., expired or not yet valid) are ignored. This is not recommended for production environments.
IgnoreInvalidHostName
Invalid host names in certificates are ignored. This means that certificates with a host name that does not match the actual host are still accepted. This is not recommended for production environments.
AllowUntrustedCertificates
Untrusted certificates are allowed. This means that certificates that are not signed by a trusted Certificate Authority are still accepted. This is not recommended for production environments.

Remarks

The HostPolicyFlags enumeration is used by the System.Net.Security.SslStream class to control how network security operations are performed. The flags can be used to bypass certain security checks, which can be useful for testing or for specific scenarios where security requirements are relaxed.

It is important to understand the implications of using these flags, as they can significantly weaken the security of your application. In most cases, it is recommended to use the default settings and avoid using these flags unless absolutely necessary.

The NoFlags member is the default and should be used whenever possible. The other flags are provided for specific scenarios and should be used with caution.