0

is it possible to create a code for this? (prevent access to a folder?) or do something similar to achieving this goal?

i just want that when my program is running. my application folder cannot be access through (example MyDocuments)

Dulini Atapattu
  • 2,735
  • 8
  • 33
  • 47
Katherina
  • 2,153
  • 7
  • 26
  • 34
  • 1
    Your program would need pretty high privileges to change the ACL of the folder(s). Are you sure there is a problem? – H H May 23 '11 at 08:47
  • Why do you need this? Knowing this can help answer the question. Who do you need to block from accessing the folder? (If we use ACL to put this restriction in place an administrator will be able to gain the access anyway) – Andrew Savinykh May 23 '11 at 10:24

2 Answers2

1

From what you are asking it sounds like you are trying to do this. The DirectorySecurity class also provides you means to work with permissions and access rights to folders, so you may want to do some research there. ..And here is one more article to assist you in your venture. Basically the DirectorySecurity class is an implementation of the Windows File System Security and allows you to modify the ACL of a directory by means of GetAccessControl, and SetAccessControl. I would recommend going through the MSDN documentation to understand how these work, because there are more than one object involved.

David Anderson
  • 13,558
  • 5
  • 50
  • 76
-1

Set security privalage. R click on folder, properties security.

VoonArt
  • 884
  • 1
  • 7
  • 21
  • Hi, Sorry but i didnt really get what you said. R click on folder? – Katherina May 23 '11 at 09:44
  • He only wants this behavior while the application is running, so setting NTFS security priviledges doesn't meet his requirement. – David Anderson May 23 '11 at 10:16
  • It does seem I have overlooked the name and profile picture. My apologies. – David Anderson May 23 '11 at 10:27
  • its ok, no need to apology, well im trying to prevent end user's to access my application folder, im making a simple cafe management program. and kids starts to go inside the folder of my program. then delete some of the files there, soo i was wondering if its possible. well with some research i was able to make a code for it to work, but its not 100% perfect yet,because 5 out of 15 PC is still accessible, i dont know if its because of windows XP(due to some i have used a modded version) – Katherina May 24 '11 at 01:38