File And Directory Rights

  • Thread starter Thread starter jehugaleahsa
  • Start date Start date
J

jehugaleahsa

Hello:

I have been looking online trying to find a simple way to find file/
directory rights in C#.

I have been seeing a lot of options, none of which are obvious. I am
looking for something like this:

bool CanRead(string path) . . . // would be willing to write this
myself

If you can help me get started, that would be great. And if possible,
can we ignore any Microsoft.Win32 libraries? I want to stick to
System.* libraries.

Thanks muches!

~Travis
 
These are the classes I was looking at yesterday. Could you give an
example that just checks if an application can read a directory? I
have no idea how to use these methods.

It's not the application that can or cannot read a directory, it's the
user.

I admit, I haven't used the .NET ACL stuff. But I believe it's what you
want. You need to cross-reference the ACL retrieved for a file system
object with the current user and their rights, which should tell you the
theoretical rights you have for the object.

How to do this specifically, I don't know. But the ACL is where that
information is stored, so that's where I believe you need to start looking.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top