HostProtectionException Class

Note: This class is new in the .NET Framework version 2.0.

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

Namespace: System.Security
Assembly: mscorlib (in mscorlib.dll)

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Class HostProtectionException
	Inherits SystemException
Dim instance As HostProtectionException

/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public class HostProtectionException extends SystemException
public class HostProtectionException extends SystemException

A 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 HostProtectionAttribute is called, a link demand occurs for that protection attribute. If the caller does not meet the demand for host protection, a HostProtectionException is thrown.


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


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions