Re: Setting directory permissions (.NET)

Hi Peter,
Does this snippet help?

Dim fi As New FileInfo("C:\msnlog.txt")

Dim fs As New FileSecurity

Dim obTypeToGet As Type

fs = fi.GetAccessControl()

obTypeToGet = Type.GetType("System.Security.Principal.NTAccount")

For Each ace As FileSystemAccessRule In fs.GetAccessRules(True, True,



Now if only Joe could tell me why this returns an empty collection????

For Each aRule As FileSystemAuditRule In fs.GetAuditRules(True, True,





"Peter Bradley" <pbradley@xxxxxxxxxx> wrote in message
Peter Bradley wrote:
Joe Kaplan wrote:
I'm not sure the exact setting to recommend to you, but the technique I
usually use when doing this type of stuff is to take before and after
snapshots in code of the security descriptor and compare the differences
you got when you make the change you want in the UI. That technique
nearly always reveals the difference and the setting you need.

Joe K.

Thanks, Joe. I think I probably need a translation, but in the first
instance I'll talk to our admins who will probably have a better idea
than me.

If they need a translation as well, I'll get back to you if that's OK.



Usual apologies for replying to self and for the double post in my last
reply (mea culpa).

Joe (or anyone else who's interested, of course), I tried to create a
program that would create a snapshot as you suggested, using the code in
your excellent book (pp302,303). I get stuck on the call to
GetAccessRules(), because I don't know how to get something I can pass as
the third parameter (presumable the sid for the folder???). Here's what I
have so far:

namespace Uwic.ACEList
class AceList
static void Main(string[] args)
DirectoryInfo dInfo = new
DirectorySecurity dSecurity = dInfo.GetAccessControl();
AuthorizationRuleCollection rules = null;
rules = dSecurity.GetAccessRules(true, true, typeof(?????));


Relevant Pages

  • File Security
    ... Dim fs As New FileSecurity ... Dim obTypeToGet As Type ... For Each ace As FileSystemAccessRule In fs.GetAccessRules(True, True, ... 'Security wrapper classes' that are out there ...
  • Is Operator question
    ... I have created a Class "Person3", ... bResult = joe Is joe ' true ... Sub Main ... Dim Joe as New Person3 ...
  • Re: Please help : System.Data.OleDb.OleDbException: Syntax error i
    ... Also Joe, be careful of using Date as a column name as well, I know you didn't use it here but I had to find out the hard way. ... They could easily put in malicious SQL for one of those values. ... The SQL string looks fine because I pasted the ... >> Dim objDataReader as OledbDataReader ...
  • Re: getting the PwdLastSet attrib value though .net
    ... > Dear Joe ... > Public Interface IADsLargeInteger ... > Property HighPartAs Int32 ... >> dim pwdDate as DateTime ...
  • Re: Mre info:Running in IDE and using Executable provide different
    ... > Hi Joe! ... >>> Private Sub cmdSearch_Click ... Dim tName As String ...