Executing code directly is possible - you can use the compiler built into .NET top compile and execute code, but it is a very bad idea to try, as it exposes the whole of the .NET framework to your user, which would give them complete control of your server - not a good idea unless you can absolutely trust every single person who might ever access your site. And I don't trust any of them!
The other problem with that approach is that it requires the user to enter the code in a .NET language, with all the syntax that that requires.
I think that you are going to have to parse it yourself, and process the commands yourself - it's basically a whole macro language you want to add!
This might help - but don't expect this to be particularly quick!
http://msdn.microsoft.com/en-us/magazine/cc164072.aspx[
^]