German Latorre
German Latorre

Reputation: 11148

Is it possible to execute uploaded .NET code in an isolated environment?

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

Answers (2)

Tim Cools
Tim Cools

Reputation: 1172

You can compile and run the code in a sandbox. This is a newly created AppDomain with restricted permissions.

Upvotes: 5

Chris Ledet
Chris Ledet

Reputation: 11628

You can take a look at AppDomains. It's an isolated environment where applications execute. Take a look.

Upvotes: 1

Related Questions