Under .NET some compilers are part of the Framework. So you can call these compilers and compile some code and run it as part of your application. This makes it a cheap scrpiting engine. That's for the theory. But practically ? Is my way the correct one ? The
user of the ASP.NET app can create a function in an TextArea:
Public Function Add(ByVal X as Integer, ByVal Y as Integer) As Integer
return (X+Y)
End Function
Next, I embody this code into a class, because by instinct this seems to me to be the better way to calling it once compiled. I create a file "script.vb" containing:
Public Class ScriptClass
Public Function Add(ByVal X as Integer , ByVal Y as Integer) As Integer
return (X+Y)
End Function
End Class
How do I get the compiler errors back ? Once compiled.
how do I call it from my app ? With some kind of CreateObject() ? What's more,
is this secure enough ? Can't the user inject malicous code into my class body ? Patrick
mueslilux
Member
210 Points
42 Posts
Use VB.NET savely as a scripting engine in your app
Sep 03, 2004 09:34 AM|LINK
Public Function Add(ByVal X as Integer, ByVal Y as Integer) As Integer return (X+Y) End FunctionNext, I embody this code into a class, because by instinct this seems to me to be the better way to calling it once compiled. I create a file "script.vb" containing:Public Class ScriptClass Public Function Add(ByVal X as Integer , ByVal Y as Integer) As Integer return (X+Y) End Function End ClassHow do I get the compiler errors back ? Once compiled. how do I call it from my app ? With some kind of CreateObject() ? What's more, is this secure enough ? Can't the user inject malicous code into my class body ? Patrick