[ Home | Forums | About | Sponsors ]
  Welcome, Guest. Please Login or Register
Google
 
Web gotmono.com
  Web Design donated by IdeaZone.ca
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
(Read 948 times)
leomatic
YaBB Newbies
*
Offline

I love YaBB 1G - SP1!

Posts: 2

FileInfo and GetAccessControl
Aug 18th, 2008, 4:29pm
 
Hi, I hope I'm in the right place here(I see nothing but derogatory adds).  I'm new to mono and C# programming, and I get this error when I go to compile my code:

error CS0117: `System.IO.FileInfo' does not contain a definition for `GetAccessControl'

I'm using the latest mono so I don't get what the problem is.  Here's the code - it's from a tutorial:

using System;
using System.Security;
using System.Security.Principal;
using System.Security.AccessControl;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace DirManip
{
class Program
{
       static void Main(string[] args)
       {
               if (File.Exists("quote.txt"))
               {
                       if (!Directory.Exists("quotedir"))
                       {
                               Directory.CreateDirectory("quotedir");
                       }
                       FileInfo f = new FileInfo("quote.txt");
                       if (!File.Exists(@"quotedir/quote.txt"))
                               f.CopyTo(@"quotedir/quote.txt");
                       Console.WriteLine("File: " + f.FullName);
                       Console.WriteLine("Location: " + f.Directory.FullName);
                       Console.WriteLine("Created: " + f.CreationTime.ToShortDateString());

                       FileSecurity fs = f.GetAccessControl(); //error here
                       Console.WriteLine("Owner: {0}", fs.GetOwner(typeof(NTAccount)));
                       AuthorizationRuleCollection arc = fs.GetAccessRules(true, true, typeof(NTAccount));
                       foreach (FileSystemAccessRule ar in arc)
                       {
                               Console.WriteLine(ar.ToString());
                               Console.WriteLine("User: {0}", ar.IdentityReference);
                               Console.WriteLine("Type: {0}", ar.AccessControlType);
                       }
               }
       }

}
}
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print
 

Copyright © 2003-2008, The Mono Community
Website Design donated by IdeaZone.ca