Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 104981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:22:01+00:00 2026-05-11T01:22:01+00:00

I am writing an application to manage user access to files. The short version

  • 0

I am writing an application to manage user access to files. The short version of a very long story is that I have to use directory and file priveleges to do it. No document management system for our cheap CEO…

Anyway… I have everything working except the case where the user can view which files are in the directory but not actually see the contents of the file. (There may be sensitive HR data in the files.)

I tried FileSystemRights.ListDirectory, but that seems to (dispite MS documentation) set ReadData to true as well. I turn off ReadData (the ability to read the files) and I suddenly have no access to the directory again. The two appear linked.

Any ideas for which permission(s) to set to achieve this?

My current code is:

SetSecurity(pth, usr, FileSystemRights.ListDirectory, AccessControlType.Allow);  ...  public void SetSecurity(string dirName, string account,     FileSystemRights rights, AccessControlType controlType) {     // Get a FileSecurity object that represents the     // current security settings.     DirectorySecurity dSecurity = Directory.GetAccessControl(dirName);      dSecurity.AddAccessRule(new FileSystemAccessRule(account, rights, controlType));      // Set the new access settings.     Directory.SetAccessControl(dirName, dSecurity); } 

Thanks.

–Jerry

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:22:02+00:00Added an answer on May 11, 2026 at 1:22 am

    The FileSystemRights enum maps both ReadData and ListDirectory to the value 1, so the two are 100% equivalent as far as .NET is concerned.

    Have you tried Traverse as opposed to ListDirectory?

    Edit: Based on this KB article it appears that Windows XP considers them to be the same too, just one applies only to files, and one applies only to directories.

    Edit 2: As long as you set the ReadData/ListDirectory access rule to NOT be inherited by child objects, you should be able to apply it to the directory without applying it to the files in the directory. The FileSystemAccessRule class does support changing inheritance flags.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a web application that allow user upload their files on the app.
Currently i'm writing a JDBC application to manage a MySQL database. I have the
I am writing an application that allows a user to place images on a
I am writing an application that reads in a large number of basic user
I am writing an application that allows a user to submit a query to
I'm writing a PHP application that manages some LDAP entries. I have one page
I am writing an MVC 3 application that needs to allow the user to
I have an application that is using Windows Authentication and a SqlRoleProvider for user
I’m writing an CI application that has to have authentication and preferably different roles
I am writing an Android application that requires the user's current location. I register

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.