If I have an app that allows users to enter C# code, how can I sandbox this code to block any malicious scripts?
In a very rudimentary example the app would be a textbox with a button that says "Compile". I then use the "codeDomProvider.CompileAssemblyFromSource" to compile and run the code.
I've seen the possibility of a AppDomain but that seems to be for external DLLs being referenced in, rather than code inside of an already complied and running app.
Is AppDomain the correct approach here so that when the "compile" button is pressed the usercode is ran in a sandbox?