Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing C# or VB.NET code at Runtime

Been spending some time on Codility.com recently and it crossed my mind; how do they execute the code you have created (Specifically pertaining to C# and VB.NET) ?

What I am basically wondering is how would I take a textbox on a form type some code in it and then run that code? Is this possible without 3rd party tools?

Also how would you prevent security violations specifically pertaining to a web based implementation of such a program?

like image 332
Maxim Gershkovich Avatar asked Sep 16 '26 07:09

Maxim Gershkovich


1 Answers

Have a look at http://msdn.microsoft.com/en-us/library/system.codedom.compiler.aspx Executing such code in a web app is in deed a security problem. .Net provides a set of functionalities to help you solve that problem, like the possibility to run your compiled code in a different app domain as a different user.

like image 98
Achim Avatar answered Sep 18 '26 20:09

Achim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!