0

I'm looking a way to run codes provided as a string...

Example: I want to store some asp.net c# codes in a database table and I would like to run it on a page.

For example:

string codesFromDBTable = "Response.Write(abc)" //something like that...

Is that possible?

0

2 Answers 2

3

Sure, it's possible using CSharpCodeProvider. But I can't stress enough how careful you should be executing arbitrary code from any source...

You might want to consider isolating the code you compile and execute into a separate AppDomain and limit the privileges available to it.

What exactly is your use case?

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

Comments

1

Is something like this what you are looking for?

http://www.codeproject.com/Articles/9019/Compiling-and-Executing-Code-at-Runtime

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.