2

Possible Duplicate:
In .NET 4.0, how do I ‘sandbox’ an in-memory assembly and execute a method?

The scenario is as follows. I want to have a view where the user puts in a few things that can be composed to a c# class:

public class my3rdpartyclass
{
   public void withOneMethod()
   {

   }
}

I would like to compile this on the fly, this is not the hard part i guess. But how do i secure my system, such the the 3rd party code inside withOneMethod can not run any stuff that can damage my system or access properties from web.config or system information.

Is something like this possible?

Community
  • 1
  • 1
Poul K. Sørensen
  • 16,950
  • 21
  • 126
  • 283
  • 2
    Not a full answer so: You load your class in a separate app domain, giving that appdomain lesser privileges. http://stackoverflow.com/questions/665668/usage-of-appdomain-in-c-sharp and possible duplicate of this: http://stackoverflow.com/questions/5997995/in-net-4-0-how-do-i-sandbox-an-in-memory-assembly-and-execute-a-method?rq=1 – hometoast Nov 13 '12 at 13:00
  • 1
    Okay, thanks. I didnt know what to search for. Knowing about AppDomain and stackoverflow also found some dublicates for me(didnt see them when i created the question). Decently looks possible. Thanks. – Poul K. Sørensen Nov 13 '12 at 13:58

0 Answers0