WebPermissionAttribute Constructor

WebPermissionAttribute Constructor (SecurityAction)


Initializes a new instance of the WebPermissionAttribute class with a value that specifies the security actions that can be performed on this class.

Namespace:   System.Net
Assembly:  System (in System.dll)

public WebPermissionAttribute(
	SecurityAction action


Type: System.Security.Permissions.SecurityAction

One of the SecurityAction values.

Exception Condition

action is not a valid SecurityAction value.

The SecurityAction value passed to this constructor specifies the allowable security actions that can be performed on this class.

Legacy Code Example

The following example demonstrates how to apply WebPermissionAttribute to a method.

// Create an array containing the arguments.
object[] args = {"Argument 1", "Argument 2", "Argument 3" };

// Initialize a ParameterModifier with the number of parameters.
ParameterModifier p = new ParameterModifier(3);

// Pass the first and third parameters by reference.
p[0] = true;
p[2] = true;

// The ParameterModifier must be passed as the single element
// of an array.
ParameterModifier[] mods = { p };

// Invoke the method late bound.
obj.GetType().InvokeMember("MethodName", BindingFlags.InvokeMethod,
     null, obj, args, mods, null, null);

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft