开发者

.Net C# Program writable folder only to a specified set of processes

How can i set a folder to be writable only to a set of process that are launched by the same master proce开发者_开发技巧ss ?

edited:

My goal is to have a program wich controls a folder (and subfolders) . Only he can , write or alter the content of that folder. The user will have acess to those contents but he cannot alter them ( he can view, execute) .


There is no built-in .NET library that will accomplish what you're after. One challenge to overcome is that (assuming you're on NTFS, there are no process-level file/folder permissions, there are only ACLs which are user/group level.)

One way you might achieve this would be to create an exclusive lock on the directory (ShareMode = None). Then to allow other processes to create handles to that directory they will need to be child processes which inherit parent handles. Doable, but not trivial.


Have a look at Isolated Storage. You can set different scopes App Domain, Assembly, etc that the storage is accessible by.

IsolatedStorageFile Class

MSDN Isolated Storage

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜