MessageQueuePermissionAttribute.CreatePermission Method ()


Creates the permission based on the requested access levels, category, label, computer name, and path that are set through the PermissionAccess, Category, Label, MachineName, and Path properties on the attribute.

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

public override IPermission CreatePermission()

Return Value

Type: System.Security.IPermission

A IPermission that represents the created permission.

The following code example calls CreatePermission.

// Connect to a queue on the local computer.
MessageQueue queue = new MessageQueue(".\\exampleQueue");

// Create a new instance of MessageQueuePermissionAttribute.
MessageQueuePermissionAttribute attribute =
    new MessageQueuePermissionAttribute(

// Set the attribute's Path property value, based on the queue's Path
// property value.
attribute.Path = queue.Path;

// Get an IPermission interface by calling the attribute's
// CreatePermission() method.
System.Security.IPermission permission = attribute.CreatePermission();

.NET Framework
Available since 1.1
Return to top