Reputation: 11148
In a .NET web site I need to get code submitted by users, compile it and execute it. But I need code to be executed in an isolated environment so that no malicious code can harm my system (for instance, no Directory.Delete("C:\Windows") should be ever executed).
Is it possible to execute code in a kind of chroot environment?
Upvotes: 2
Views: 1015
Reputation: 1172
You can compile and run the code in a sandbox. This is a newly created AppDomain with restricted permissions.
Upvotes: 5
Reputation: 11628
You can take a look at AppDomains. It's an isolated environment where applications execute. Take a look.
Upvotes: 1