What I need to do is : Read a local C#
text file, execute a method from that. This is what I'm doing.
- Read all text from the file
- Compile into a local
x.dll
withCSharpCodeProvider
- Load the dll with
Assembly.LoadFrom()
- Then execute the method with
GetType().GetMethod().Invoke()
It works fine. Now, I want to run this code securely, i.e. restrict this code from accessing the file system, network etc. Basically, I need to run this with minimal privileges.
I tried the code from Restrict plugin access to file system and network via appdomain (answer by @Babar), but still not working as expected. The code in the text file is still able to access file system.
What I'm missing here? Any other way to make it work?
Aucun commentaire:
Enregistrer un commentaire