Aracılığıyla paylaş


MessageQueuePermissionAttribute.CreatePermission Yöntem

Tanım

özniteliğindeki , CategoryLabel, , ve özellikleri aracılığıyla PermissionAccessayarlanan istenen erişim düzeylerini, kategoriyi, etiketi, MachineNamebilgisayar adını ve Path yolu temel alarak izni oluşturur.

public:
 override System::Security::IPermission ^ CreatePermission();
public override System.Security.IPermission CreatePermission ();
override this.CreatePermission : unit -> System.Security.IPermission
Public Overrides Function CreatePermission () As IPermission

Döndürülenler

IPermission Oluşturulan izni temsil eden bir.

Örnekler

Aşağıdaki kod örneği çağrıları 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();

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

// Create a new instance of MessageQueuePermissionAttribute.
MessageQueuePermissionAttribute attribute =
    new 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();

Şunlara uygulanır