HostProtectionException Constructor (String, HostProtectionResource, HostProtectionResource)

Initializes a new instance of the HostProtectionException class with a specified error message, the protected host resources, and the host resources that caused the exception to be thrown.

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

public HostProtectionException(
	string message,
	HostProtectionResource protectedResources,
	HostProtectionResource demandedResources
)

Parameters

message
Type: System.String

The error message that explains the reason for the exception.

protectedResources
Type: System.Security.Permissions.HostProtectionResource

A bitwise combination of the enumeration values that specify the host resources that are inaccessible to partially trusted code.

demandedResources
Type: System.Security.Permissions.HostProtectionResource

A bitwise combination of the enumeration values that specify the demanded host resources.

The demandedResources parameter specifies the demanded host protection categories that caused the exception to be thrown. For example, suppose that a method has a HostProtectionAttribute attribute that indicates that the method exposes shared state. When the method is called, the HostProtectionAttribute performs a link demand for shared state. If the host has set shared state as a prohibited category, then a HostProtectionException is raised with a demandedResources property value of HostProtectionResource.SharedState.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft