By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,054 Members | 1,327 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,054 IT Pros & Developers. It's quick & easy.

MSMQ - AccessControlList - Current Identity?

P: 72

When I create a message queue programmatically, I would like to ensure that the created queue has the permissions to allow the service account the app is running under to access the queue.

When I use SetPermissions on the created queue, how do I create an AccessControlEntry that holds the current app identity?

Expand|Select|Wrap|Line Numbers
  1. if (!MessageQueue.Exists(name))
  2. {
  3.     var queue = MessageQueue.Create(name);
  4.     var acl = new AccessControlList();
  5.     acl.Add(new AccessControlEntry()
  6.             {
  7.                 EntryType = AccessControlEntryType.Allow,
  8.                 GenericAccessRights = GenericAccessRights.All,
  9.                 StandardAccessRights = StandardAccessRights.All,
  10.                 Trustee = new Trustee("mycurrentappidentity")
  11.             });
  13.     queue.SetPermissions(acl);
  14. }
Aug 17 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.