Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
Hi experts,

I have a running WindowsXP with 3 users: Admin, User1 and User2. The Admin is administrator (you already guessed that).
Both users are restricted users.

Now I was under the impression that every file that User1 created could be changed/deleted by himself or by Admin. But User2 would have no chance to ever do something despite reading.

I tried that in some special folder "Dokumente und Einstellungen\All Users\Dokumente" (It's a german WinXP, english should be something like "Documents and Properties\All Users\Documents"). The result was as I had expected:
User1 creates a file, User2 can read it, Admin can do whatever he wants.

Now, on the second partition D:\ (NTFS, all of them) above rules don't seem to apply.
User1, again, creates a file and User2 can do whatever he wants, just like Admin.

Actually, the described behaviour (on D:\) is what I want to achieve: I am searching for a directory to serialize project files to. Everybody shall be allowed to open and change, no matter who created it.
I just can't be sure that on the target machine there will be a directory "D:\".

Is there, in WindowsXP, 2000, Vista, 7 a general rule what directories would behave like I saw happen in "D:\"?

I seem to get what I want by creating a directory within "All Users\Documents\" and changing that directory's permissions. I did that manually by clicking and such.

To make this a programming question: How can I change the file I/O permissions for a folder to "Everyone may do everything with folder and all sub-folders and files"?

My first try was this one:
using System.Security;
using System.Security.Permissions;

private void PermitEverything(string filename)
    NamedPermissionSet ps = new NamedPermissionSet(

        new FileIOPermission(FileIOPermissionAccess.AllAccess, filename)

        new SecurityPermission(SecurityPermissionFlag.Execution)
It doesn't work. Permissions stay as they were without even giving an error.

Edit2: I should have noted that this is about a .NET 2.0 WinForms application.
Updated 14-Apr-11 21:11pm

1 solution

This is not really a programming Question.
You can find out how it works starting here:[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900