Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SecurityException.SecurityException(String, Object, Object, MethodInfo, Object, IPermission) Constructor

Initializes a new instance of the SecurityException class for an exception caused by a Deny on the stack.

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

public SecurityException (
	string message,
	Object deny,
	Object permitOnly,
	MethodInfo method,
	Object demanded,
	IPermission permThatFailed
)
public SecurityException (
	String message, 
	Object deny, 
	Object permitOnly, 
	MethodInfo method, 
	Object demanded, 
	IPermission permThatFailed
)
public function SecurityException (
	message : String, 
	deny : Object, 
	permitOnly : Object, 
	method : MethodInfo, 
	demanded : Object, 
	permThatFailed : IPermission
)
Not applicable.

Parameters

message

The error message that explains the reason for the exception.

deny

The denied permission or permission set.

permitOnly

The permit-only permission or permission set.

method

A MethodInfo that identifies the method that encountered the exception.

demanded

The demanded permission, permission set, or permission set collection.

permThatFailed

An IPermission that identifies the permission that failed.

Use this constructor if a frame that contains a Deny caused the demand failure. The following table shows the property values set by this constructor.

Property

Value

Message

The localized error message string specified by message.

FirstPermissionThatFailed

The first permission in the permission set or permission set collection specified by permThatFailed.

GrantedSet

An empty string.

Demanded

The security permission, permission set, or permission set collection specified by demanded.

RefusedSet

An empty string.

DenySetInstance

The denied security permission, permission set, or permission set collection specified by deny.

PermitOnlySetInstance

The permission, permission set, or permission set collection specified by permitOnly.

FailedAssemblyInfo

a null reference (Nothing in Visual Basic).

Method

The MethodInfo specified by method.

Zone

NoZone.

Url

An empty string.

The following code example shows the use of the SecurityException(String,Object,Object,MethodInfo,Object,IPermission) constructor. This example is part of a larger example provided for the SecurityException class.

//Demonstrate the SecurityException constructor by 
// throwing the exception again.
Display("Rethrowing the exception thrown as a result of a " + 
    "PermitOnly security action.");
throw new SecurityException(sE.Message, sE.DenySetInstance, 
    sE.PermitOnlySetInstance, sE.Method, sE.Demanded, 
    (IPermission)sE.FirstPermissionThatFailed);

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft