0

I want to execute the code that is passed as a string to my function, the code will be passed at runtime. This is an example code that may be passed as a string to my function.

p is a dataset, which is declared and has some values, this code is executed in a asp.net page

p.Tables(0).Rows(0)("disp_status") = "Approved by CEO";
p.Tables(0).Rows(0)("status") = "Approved";
Session("fnc") = "generate po";
Session("rec_id") = p.Tables(0).Rows(0)("IndexID");
Session("ord_ref")="PR No.";
Server.Execute("../rlm/mne_pr_form_f.asp"); 
p.Tables(0).Rows(0)("status") = "Order Raised" 
p.Tables(0).Rows(0)("disp_status") = "Order Raised"
p.Tables(0).Rows(0)("lock_record") = "Yes";
Session("fnc") = "";
Session("rec_id") = "";
1
  • eval functions are evil in general purpose languages. It's fine for javascript, which is sandboxed, but for other desktop apps they allow attackers to construct strings that could do anything. Commented Mar 30, 2012 at 15:52

1 Answer 1

3

There's no Eval function as such, but depending on exactly what you want to do, you can do things like this using Reflection and here is a CodeProject article that includes a library to let you do this: Runtime Compilation (A .NET eval statement)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.