System.Security.SecurityException Class

The exception that is thrown when a security error is detected.

See Also: SecurityException Members


public class SecurityException : SystemException


A System.Security.SecurityException exception is thrown when a caller does not have the permissions required to access a resource. The following example instantiates a System.Security.PermissionSet object that includes a System.Security.Permissions.UIPermission object to allow access to UI objects and the Clipboard and a System.Security.Permissions.RegistryPermission object to prevent registry access. The call to the PermissionSet.PermitOnly method means that these permissions will apply regardless of the permissions assigned to the caller. As a result, the attempt to create a registry key throws a System.Security.SecurityException.

code reference: System.SecurityException.Class#1

System.Security.SecurityException uses the HRESULT COR_E_SECURITY, which has the value 0x8013150A.

For a list of the initial property values for an instance of the System.Security.SecurityException class, see a specific erload:System.Security.SecurityException.#ctor constructor.

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.


Namespace: System.Security
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0,,