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:
virtual IPermission^ CreatePermission() override

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 = gcnew MessageQueue(".\\exampleQueue");

// Create a new instance of MessageQueuePermissionAttribute.
MessageQueuePermissionAttribute^ attribute =
    gcnew MessageQueuePermissionAttribute(
    System::Security::Permissions::SecurityAction::Assert);

// 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();

queue->Close();

.NET Framework
Available since 1.1
Return to top
Show: