在运行时执行C#或VB.NET代码 [英] Executing C# or VB.NET code at Runtime
问题描述
我基本上想知道我将如何在表单上使用一个文本框在其中键入一些代码,然后运行该代码?是否可以没有第三方工具?
另外,如何防止与此类程序的基于Web的实现相关的安全性违规?
看看 http://msdn.microsoft.com/en-us/library/system.codedom.compiler.aspx 在Web应用程序中执行此类代码是一个安全问题。 .Net提供了一组功能来帮助您解决这个问题,例如将不同用户的编译代码运行在不同的应用程序域中。
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?
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.
这篇关于在运行时执行C#或VB.NET代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!