From here we have two approaches: to Eval the function code or to create “Script” element dynamically.
First approach is very straightforward:
string src = txtScript.Text;
Second approach is pretty much of the same, but creates a real “Script” block in the document’s body:
HtmlElement Script = HtmlPage.Document.CreateElement("script");
Now all we have to do is execute the function:
string funcParames = null;
if (txtFunctionParams.Text.Length > 0)
funcParames = txtFunctionParams.Text;
That’s it… Running application here:
Sure this application is pretty simple and unsecure, but this is only a demo and could be enriched with any needed functionality.
p.s. Noam – many thanks for idea ;)