Re: How to find out file owner?



I'm not sure what the problem is, but can you explain more about what
doesn't work? Does it crash? Can you not access the security descriptor?
Can you just not access the owner or does the translation of the SID into an
NTAccount fail?

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"Dmitry Nogin" <dmitrynogin@xxxxxxxxxxx> wrote in message
news:e9Lr0EKQHHA.4172@xxxxxxxxxxxxxxxxxxxxxxx
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



.



Relevant Pages

  • Re: Web Single Sign On
    ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... current Windows credentials to the server, ... This common identity is the user's username used to logon to the ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Changing ADAM user password
    ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... Running the bind from another W2K3SP1 machine ... support in digest or something like that. ...
    (microsoft.public.windows.server.active_directory)
  • Re: ASP.NET 2.0 WindowsTokenRoleProvider Local Groups Broken
    ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... There is no Group property on the WindowsIdentity object in .NET 2.0, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Secure SSL with LDAP and AD
    ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... LDAP over SSL with a third-party certification authority. ... Note that a self signed cert is probably a very poor choice as nothing ...
    (microsoft.public.windows.server.security)
  • Re: SignOn Problem during Team Foundation WebTest Playback
    ... That sounds likely to me (the query string parameters). ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.windows.server.active_directory)