Click to See Complete Forum and Search --> : Write files to Bin folder
vbUserName
February 10th, 2006, 02:28 PM
Hi friends !!!
This is my issue: my asp.net application dynamically compiles a C# code (which takes from a TextBox) into a dll file, which writes in Bin folder.
The problem is that I'm not allowed to place files in Bin folder with aspnet user... I tried with impersonation but doesn't work...
Any help???
Thanks !!!
mmetzger
February 10th, 2006, 04:06 PM
What are you trying to do? The safeguard is there for a reason so that the web server account can't overwrite code that is already there.
vbUserName
February 13th, 2006, 07:09 AM
After generating a new dll based on the code that I receive, the dll has to be placed in Bin folder... I suppose there has to be a way to do this... ?
vbUserName
February 13th, 2006, 09:06 AM
What I need is to dynamically execute code, which comes as a parameter in a textbox.
My solution right now is to store the text in a .cs file, and then run a batch file that calls .net compiler, generating a dll.
Then I need to use that dll (its functions). For this I have to place the dll in Bin folder...
I hope you can help me !
mmetzger
February 13th, 2006, 02:31 PM
Try looking at Reflection.Emit. It's about the only way you're going to be able to dynamically execute code in this fashion without completely destroying .NET's security safeguards. You should be able to generate and reference an in memory assembly.
The other option is to store the code as an .aspx page and call it. The problem here is once again you're leaving the site wide open.
vbUserName
February 14th, 2006, 07:51 AM
Thank you !!!
I looked or some code which uses Reflection and CodeDom, and it works very well...
Thanks again !
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.