System.Security.HostProtectionException Class

The exception that is thrown when a denied host resource is detected.

See Also: HostProtectionException Members


public class HostProtectionException : SystemException


A System.Security.Permissions.HostProtectionAttribute attribute is used to determine if a type or member can be loaded, based on the host’s protection preferences established when the common language runtime is started. If a type or member with an active System.Security.Permissions.HostProtectionAttribute is called, a link demand occurs for that protection attribute. If the caller does not meet the demand for host protection, a System.Security.HostProtectionException is thrown.


A System.Security.Permissions.HostProtectionAttribute is not a permission, even though it is the target of a link demand. Because a System.Security.HostProtectionException is thrown for a link demand, it cannot be handled, and therefore it cannot be trapped and processed in code.


Namespace: System.Security
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0