I am uploading DLLs from client machines to a server. These DLLs will be created and executed via reflection. Each DLL should have read/write on only one specific directory on the server. This directory is specific to the DLL.
I want a way of forcing the DLL to only be able to access its own specific directory. Since the DLLs are uploaded, I want to be able to assign this permission dynamically.
IF you force the DLLs to use your API – for example via a shared object providing them with FileSystem-Access then you could just run the respective DLL in a separate AppDomain which you setup with a reduced PermissionSet (i.e. without File IO permission)…
This way .NET enforces the needed security and your API can provide any operation you want to restrict/log etc. like File IO…