How to find out file owner?
- From: "Dmitry Nogin" <dmitrynogin@xxxxxxxxxxx>
- Date: Thu, 25 Jan 2007 18:55:55 +0200
Hi,
The following code doesn't work for mapped drives:
using System;
using System.Text;
using System.Threading;
using System.Security.AccessControl;
using System.Security.Principal;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
FileInfo fi = new FileInfo(@"c:\boot.ini");
FileSecurity fs = fi.GetAccessControl();
IdentityReference ir = fs.GetOwner(typeof(NTAccount));
Console.WriteLine(ir.Value);
}
}
}
What should I do to make it work for mapped drives or UNC (like
\\10.0.61.22\c$\boot.ini)?
(Windows XP network; logged on using domain administrator account)
Thanks
.
- Follow-Ups:
- Re: How to find out file owner?
- From: Joe Kaplan
- Re: How to find out file owner?
- Prev by Date: security exception *strongnameidentity*asp.net
- Next by Date: Why a ClickOnce Trusted Application don't failed when I change my Code groups Security params ???
- Previous by thread: security exception *strongnameidentity*asp.net
- Next by thread: Re: How to find out file owner?
- Index(es):
Relevant Pages
|