MessageQueuePermissionAttribute.CreatePermission Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
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
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();
// 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();
Product | Versions |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: